Ernie Smethurst wrote:
Code:

PositionAttitudeTransform *rotate_planetFive = new PositionAttitudeTransform;
rotate_planetFive->addChild( geode_planetFive );
rotate_planetFive->setUpdateCallback( new 
AnimationPathCallback(osg::Vec3(0,0,0), osg::Z_AXIS, inDegrees(45.0f)) ); //ROTATE 
AROUND THE SUN
Vec3 central_point = primitive_planetFive->getCenter(); //GET THE CURRENT 
LOCATION OF THE CIRCLE WHILST IS ROTATES
rotate_planetFive->setUpdateCallback( new 
AnimationPathCallback(osg::Vec3(central_point), osg::Z_AXIS, inDegrees(45.0f)) );



But that doesnt work, it only applies the second setUpdateCallback() when i 
need both to run.

Sorry if it seems I am posting excessively, I just get a little bit obsessive 
when I cant get the coding correct, Apologies.

Of course it does. You replace your first update callback on one transform with a second. As I said before, you need three transforms here. A rotate, followed by a translate, followed by another rotate. Since you're using PAT's, one of them can handle two transforms (one rotate and one translate, which is what you have now), but you'll need a second transform to do the other rotation.

As I said in my previous message, in a scene graph like OSG, you combine rotations by using the graph's hierarchy. What you should have is your planet's geometry as a child of a PAT doing a rotation, which itself is a child of another PAT doing the other rotation and the translation. The final PAT should be attached to the root of the scene.

--"J"

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to