I want to set the orientation of an object after I retrieve an Ogre::Vector3 somewhere else?
Ogre::SceneNode *sn;
sn->rotate(...);
this accepts a quaternion, what is the Vector3 counterpart?
Thanks
Jack
How to set the orientation of an object with a Ogre::Vector3
-
- Gremlin
- Posts: 156
- Joined: Tue Sep 18, 2012 3:43 am
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: How to set the orientation of an object with a Ogre::Vec
Thishas the answer.
But in you case it's the other way around. You use the getRotationTo on your initial directional vector.
Code: Select all
// Get rotation to original facing
Vector3 currentFacing = mNode->getOrientation() * mInitFacing;
Quaternion quat = currentFacing.getRotationTo(mInitFacing);
mNode->rotate(quat);
-
- Gremlin
- Posts: 156
- Joined: Tue Sep 18, 2012 3:43 am
Re: How to set the orientation of an object with a Ogre::Vec
Great! it does the magic.
Jack
Jack
- Kojack
- OGRE Moderator
- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 534
Re: How to set the orientation of an object with a Ogre::Vec
There's also SceneNode::setDirection (make the scene node face a direction) and SceneNode::lookAt (make the scene node face towards an absolute position).