WENIE RAHARDJA
Effects + CGI
  • work
  • Reel

Aligning Object Along the Curve with Translation Matrix

8/14/2016

 
I found this to be the easiest way to align object orientation along a curve. Using pointOnCurve command, you can query the position, tangent, and normal information. Using normal and tangent vector, find the bi normal / cross product and arrange all the numbers in a translation matrix with xform command. Normalized everything except position.
Picture
Finding the cross product
Mel or python has the "cross product" command, but to do it manually, you can do this:

Given the normal { Nx, Ny, Nz }   and tangent {Tx, Ty, Tz}

binormal = Ny*Tz - Nz*Ty , Nz*Tx - Nx*Tz, Nx*Ty - Ny*TX


​Prevent the normal from "roll" around the curve
Specify the "up vector" for the curve. For example, Y can be up vector. Using this information, find the normal by calculating the cross product between tangent and the up vector. 

Given the up vector { Ux, Uy, Uz }   and tangent {Tx, Ty, Tz}

normal = Uy*Tz - Uz*Ty , Uz*Tx - Ux*Tz, Ux*Ty - Uy*TX

Reference

https://ilmvfx.wordpress.com/2014/01/28/how-do-i-align-an-object-to-a-curve-without-using-a-constraint/

http://tutorial.math.lamar.edu/Classes/CalcII/CrossProduct.aspx



Comments are closed.

    Categories

    All
    Hair / Fur
    Scripting