Sunday, August 30, 2015

rotation - Rotate an object around a point in Ogre3D




Possible Duplicate:
How can I rotate about an arbitrary point in 3D (instead of the origin)?



I am new to 3D programming and I have been using Ogre3D lately to get a grasp of it.


What I am trying to do is the following:


Image rotation


I want to make an entity rotate around a point (probably the parent SceneNode) in a circular way only in the X and Z axis.


I have tried using yaw/pitch/roll and rotate but no luck, and I can't find any good tutorials/how-tos online.




Answer



I finally did it using the following pseudo-code:


parent = sceneMgr->getRootSceneNode()->createChildSceneNode();
child = parent->createChildSceneNode();
child->attachObject(entity);
child->translate(10,0,0);
parent ->rotate(Ogre::Quaternion(Ogre::Degree(10), Ogre::Vector3(1,0,0)) , Ogre::Node::TransformSpace::TS_WORLD);

For anyone who has the same problem as me.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...