No Worries

Fixed this by creating a new animation path with the offset and swapping
with the original. Code now looks like this

 //if animation update callback is found add the rigid body animate callback

                        osg::AnimationPathCallback* apc = dynamic_cast
<osg::AnimationPathCallback*>(osgTrans->getUpdateCallback());

                        if(apc){

                            osgbBullet::RigidBodyAnimation* rba =
newosgbBullet::RigidBodyAnimation;

                            apc->setNestedCallback(rba);



                            //add the world offset to the

                            osg::AnimationPath* aniPath = apc->
getAnimationPath();

                            osg::AnimationPath* newPath =
newosg::AnimationPath();

                            float time = 0.0f;

                            osg::AnimationPath::TimeControlPointMap tcpm =
aniPath->getTimeControlPointMap();


for(osg::AnimationPath::TimeControlPointMap::iterator
tcpmitr=tcpm.begin();

                                tcpmitr!=tcpm.end();

                                ++tcpmitr)

                            {

                                //add world offset

                                osg::AnimationPath::ControlPoint cp(tcpmitr
->second.getPosition()+_worldOffset, tcpmitr->second.getRotation(), tcpmitr
->second.getScale());

                                newPath->insert(time, cp);

                                time += (1.0f/30.0f);

                            }

                            apc->setAnimationPath(newPath);

                        }

                    }


I'm still a little confused as to why the original didn't work?

Cheers

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

Reply via email to