Hello,
using maxscript, I wish to place an object over a spline, orienting it using the tangent vector at a spline point.
What I do now is:
-get the tangent vector from the spline sampled point
-build a matrix from the tangent
-put the matrix (translated to the spline sampled point) to an object
It works, but I haven’t control over the normal and binormal vectors of the resulting plane. (sometimes my up vector is Y, sometimes is X).
Which is the best way to calculate and force an UP vector (like a pole vector) to the plane I have from the spline tangent?
There’s no such thing as a plane defined by a single vector. You need two.
You can arbitrarily decide on a “side” vector to define the plane, then find the up vector using the cross product of the spline tangent and side vector.
@Bronwen: that’s the point, using matrixFromNormal maxscript function, I get a plane with arbitrary side and up vectors. I wish to define them to have the same up vector on every point on the spline.
rather than matrixFromNormal, you can construct the matrix yourself as bronwen suggests. cross the tangent with the up vector, and then cross this result with the tangent to get the 3rd conponent, arrange these axes as you want them in the matrix and perform the same consistent process on each spline knot. At least you will get consistent space for each one that way.