## 31/07/2019

Lately I have worked a lot with alembic files that have point level animated geometry and once I had to attach objects to that PLA geometry. I figured out a couple different ways to do this (e.g. MoGraph Cloner or Contraint Tag) but my favorite solution is to use Xpresso and Python.

In this setup I’m taking three points from selected polygon. Then I’m creating vectors v1 and v2 from those points’ positions. Then vectors are used to generate orthogonal axes by using cross product.

import c4d import math def main(): global Matrix v1 = Point1 - Point0 # Generate first vector from two point positions v2 = Point2 - Point0 # Generate second vector from two point positions m = c4d.Matrix() # Initialize a matrix m.v1 = v1.GetNormalized() m.v3 = v1.Cross(v2).GetNormalized() m.v2 = m.v3.Cross(v1).GetNormalized() m.off = Position # Set position Matrix = m # Output