Page 1 of 1

How to rotate a surface so it has a given normal?

Posted: Sun Sep 20, 2009 6:55 pm
by TaviO!
Say I have a triangle with normal X. How do I rotate so it has a given normal Y?

Posted: Sun Sep 20, 2009 7:16 pm
by hybrid
You can use the quaternion function to get the rotation necessary to get one vector to another. The apply this rotation to the node. If the rotation is bound to one axis you could use the vector class to get the values as well.

Posted: Sun Sep 20, 2009 7:43 pm
by TaviO!
How do I apply the 4x4 rotation matrix to the node?

The setPosition method only accepts a vector3df.

Thanks for the answer!

Posted: Sun Sep 20, 2009 8:03 pm
by TaviO!
Nevermind, the matrix had a getRotationDegrees method that returns what I need for the setRotation method on the node.

Thanks!