Notifications
Clear all

[Closed] convert normlized vector to rotation matrix

Hej Guys,

I would like to convert a direction to a 3dsmax rotation matrix.
I have tried to get the angles of the direction vector which returns validish only because of +/- values and acos, dealing with this didnt solve the problem. … and combining with other axis dint work out too.
Does anybody know it right out of the heart?

Thanks.

2 Replies

You can try matrixfromnormal which will return a matrix, then you just get the .rotationpart from it. You can do it long form:

dir = normalize yourNormal
yComp = cross (dir [0,0,1])
zComp = cross (dir yComp)
yComp = cross (dir zComp)

k = matrix3 dir yComp zComp [0,0,0]
k.rotationpart

thanks a lot! It works!

(the cross command doesn’t need brackets)