# Rotate an object around a point in Ogre3D [duplicate]

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:

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.

• Ugh, I don't understand any of it – Pacha Dec 28 '12 at 19:08
• Unfortunately, that's not a reason to ask the question again. Game development is very math heavy. Perhaps you can find some shortcuts in Orge3D. Any options for changing the origin of an object? If you change the origin of your circle to the dot location, then rotate, it will rotate around as you've shown. – MichaelHouse Dec 28 '12 at 19:12

## 1 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.

• Yes, that's exactly how you do this with a scene graph (not Ogre3D specific). Translate the child, rotate the parent. – Paul-Jan Dec 28 '12 at 19:39