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.

  • \$\begingroup\$ Ugh, I don't understand any of it \$\endgroup\$ – Pacha Dec 28 '12 at 19:08
  • \$\begingroup\$ 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. \$\endgroup\$ – MichaelHouse Dec 28 '12 at 19:12

I finally did it using the following pseudo-code:

parent = sceneMgr->getRootSceneNode()->createChildSceneNode();
child = parent->createChildSceneNode();
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.

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.