Notifications
Clear all
[Closed] Rotation matrix
Mar 15, 2015 11:59 am
Object has :
coordinates [x, y, z]
normalized vector-up, example [0, 1, 0]
normalized vector rotation [0, 0, 1]
Coordinates are set through $ .pos = [x, y, z]
How to use these vectors correctly rotate object?
Thanks…
2 Replies
Mar 15, 2015 11:59 am
I have used rotation through a quat
like if you want to turn an object 90 around the object normal
theNormal = polyop.getFaceNormal $ 1
rot = (matrixFromNormal (polyop.getFaceNormal $ 1)*$.transform ) as quat
$.objectoffsetrot*=RotValInv
just like looking at it’s rotation
$.rotation returns a quat
Mar 15, 2015 11:59 am
I think this might be what you asked. This is from the max help
theV = normalize [5,0,10] --the vector to rotate, normalized to unit vector
rm = rotateZMatrix 1 --create a rotation matrix from the value
theRotV = theV * rm --transform the original vector using the matrix
c = cylinder() --create a cylinder
c.dir = theRotV --orient along the vector to see what it looks like