Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question

marked as duplicate by Byte56, Sean Middleditch, Nick Wiggill, Josh Petrie, Sam Hocevar Jan 6 '13 at 19:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
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. –  Byte56 Dec 28 '12 at 19:12
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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
add comment

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