Hi Cedric,
This is sample code that reproduces this problem:
#include <osgViewer/Viewer>
#include <osg/animationpath>
#include <osg/matrixtransform>
#include <osg/ShapeDrawable>
#include <osg/PositionAttitudeTransform>
#include <osg/Node>
#include <osgDB/ReadFile>
#include <osgGA/TrackballManipulator>
#include <osg/AnimationPath>
class MoveObjectForward : public osg::AnimationPathCallback {
public:
MoveObjectForward::MoveObjectForward()
{
osg::ref_ptr<osg::AnimationPath> rPath = new osg::AnimationPath;
rPath->setLoopMode(osg::AnimationPath::NO_LOOPING);
osg::AnimationPath::ControlPoint c0(osg::Vec3(-10,0,0));
osg::AnimationPath::ControlPoint c1(osg::Vec3(10,0,0));
rPath->insert(16.0f , c0 );
rPath->insert( 20.0f, c1 );
this->setAnimationPath(rPath.get());
}
};
osg::Node* tankNode = NULL;
int main()
{
tankNode = osgDB::readNodeFile("c:\\R_Road_Street_G_Sidewalk.3DS");
osg::Group* root = new osg::Group();
osg::PositionAttitudeTransform* tankXform =
new osg::PositionAttitudeTransform();
tankXform->setName("ddd");
root->addChild(tankXform);
tankXform->addChild(tankNode);
osg::Vec3 tankPosit(-10,0,0);
tankXform->setPosition( tankPosit );
tankXform->setUpdateCallback(new MoveObjectForward());
osgViewer::Viewer viewer;
viewer.setSceneData( root );
viewer.setCameraManipulator(new osgGA::TrackballManipulator);
viewer.realize();
while( !viewer.done() )
{
viewer.frame();
}
return 0;
}
Thank you!
Cheers,
Danny
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16863#16863
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org