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

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

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

Post by TaviO! »

Say I have a triangle with normal X. How do I rotate so it has a given normal Y?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

Post by TaviO! »

How do I apply the 4x4 rotation matrix to the node?

The setPosition method only accepts a vector3df.

Thanks for the answer!
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

Post by TaviO! »

Nevermind, the matrix had a getRotationDegrees method that returns what I need for the setRotation method on the node.

Thanks!
Post Reply