Usually when I want to rotate an object/node in my Ogre scene I call the node's rotate()
method. That rotates the node locally relative to it's current rotation. So for example, when I start with 0 rotation, then rotate twice for 5 degrees about one axis, then after the second call the object is rotated by 10 degrees in total.
Now I need to set the absolute rotation of the node/object directly, regardless of its current rotation. Thus, say I don't know the objects current rotation, I need to set it say to 45 degrees on the X axis. Something like setRotation()
.
I know there is a setOrientation()
method in the SceneNode
class, which expects a quaternion object. I also know that I can get the current orientation quaternion. What I don't know: how can I use/change this current orientation quaternion to set the new absolute rotation of the node?
PS: Crosspost at http://www.ogre3d.org/forums/viewtopic.php?f=2&t=77710
Answer
I'm just replicating the answer from that crosspost :D
setOrientation(Quaternion(Degree(45),Vector3(1,0,0)));
No comments:
Post a Comment