[osg-users] play animation backwards?
Hi, Unfortunately I couldn't figure out how to play a given animation backwards. The animation is part of a model read from an osgt file. Looking at osgAnimation/Animation.cpp it would be straightforward to add an additional switch case to Animation::update() case ONCE_BACKWARDS: t = _originalDuration - t; if (t < 0) return false; However, I wonder if there is an obvious way to achieve the same without having to modify the file Animation.cpp ? Thank you for any hints! Cheers, Thilo Ihr WEB.DE Postfach immer dabei: die kostenlose WEB.DE Mail App für iPhone und Android. https://produkte.web.de/freemail_mobile_startseite/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] play animation backwards?
Did you try decrementing the simulation time in your call to Viewer::frame()? I'm not familiar with osgAnimation internals, but other animations in oSG, such as osg AnimationPath, osgSim animated light points, and osgParticle simulations, are all based on the simulation time. It would be very odd if osgAnimation didn't work the same way. -Paul On 7/2/2012 9:09 AM, Thilo Weigel wrote: Hi, Unfortunately I couldn't figure out how to play a given animation backwards. The animation is part of a model read from an osgt file. Looking at osgAnimation/Animation.cpp it would be straightforward to add an additional switch case to Animation::update() case ONCE_BACKWARDS: t = _originalDuration - t; if (t < 0) return false; However, I wonder if there is an obvious way to achieve the same without having to modify the file Animation.cpp ? Thank you for any hints! Cheers, Thilo Ihr WEB.DE Postfach immer dabei: die kostenlose WEB.DE Mail App für iPhone und Android. *https://produkte.web.de/freemail_mobile_startseite/* ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] play animation backwards?
Hi, Thilo You can do this with://animationPathCallback is a osg::AnimationPathCallback*double animationTime = animationPathCallback->getAnimationTime();//use animation duration instead if you want to play from last frameanimationPathCallback->setTimeMultiplier(-1.0);animationPathCallback->setTimeOffset(animationTime); Cheers,Sergey.02.07.2012, 19:09, "Thilo Weigel" :Hi, Unfortunately I couldn't figure out how to play a given animation backwards. The animation is part of a model read from an osgt file. Looking at osgAnimation/Animation.cpp it would be straightforward to add an additional switch case to Animation::update() case ONCE_BACKWARDS: t = _originalDuration - t; if (t < 0) return false; However, I wonder if there is an obvious way to achieve the same without having to modify the file Animation.cpp ? Thank you for any hints! Cheers, Thilo Ihr WEB.DE Postfach immer dabei: die kostenlose WEB.DE Mail App für iPhone und Android. https://produkte.web.de/freemail_mobile_startseite/___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] play animation backwards?
Ouch, for some reason i thought you were using osg::AnimationPath animation. Cant say anything about osgAnimation. 02.07.2012, 19:56, "Sergey Polischuk" :Hi, Thilo You can do this with://animationPathCallback is a osg::AnimationPathCallback*double animationTime = animationPathCallback->getAnimationTime();//use animation duration instead if you want to play from last frameanimationPathCallback->setTimeMultiplier(-1.0);animationPathCallback->setTimeOffset(animationTime); Cheers,Sergey.02.07.2012, 19:09, "Thilo Weigel":Hi,Unfortunately I couldn't figure out how to play a given animation backwards. The animation is part of a model read from an osgt file. Looking at osgAnimation/Animation.cpp it would be straightforward to add an additional switch case to Animation::update() case ONCE_BACKWARDS: t = _originalDuration - t; if (t < 0) return false; However, I wonder if there is an obvious way to achieve the same without having to modify the file Animation.cpp ? Thank you for any hints! Cheers, Thilo Ihr WEB.DE Postfach immer dabei: die kostenlose WEB.DE Mail App für iPhone und Android. https://produkte.web.de/freemail_mobile_startseite/___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] play animation backwards?
Hi Paul, Thank your for your suggestion. Decrementing the simulation time in Viewer::frame() would probably allow to play one animation backwards. But I would be stuck if I wanted to play two different animations at the same time, one being played backwards and one in the normal direction? Cheers, Thilo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48640#48640 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] play animation backwards?
Hi, I locally changed Animation::update() to be virtual and inherited my own animation class with special "backwards animation" code in the update() function. Would it be possible to make Animation::update() virtual in future osg releases? Or is my approach rather discouraged? Thank you! Cheers, Thilo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49324#49324 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] play animation backwards?
Hi Thilo, On 18 August 2012 20:42, Thilo Weigel wrote: > I locally changed Animation::update() to be virtual and inherited my own > animation class with special "backwards animation" code in the update() > function. > > Would it be possible to make Animation::update() virtual in future osg > releases? Or is my approach rather discouraged? I'm not the author of this code so like yourself will have to read the code and make a decision about it, without this review I can't say whether changing Animation::update to virtual will present any issues. I would suggest that you modify the code and then post it to osg-submissions so that I or Cedric Pinson (osgAnimation author) can review the change with a view to merging it with OSG trunk if appropriate. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org