[osg-users] animated moving of a MatrixTransform

2011-01-11 Thread Andrew Kanter
Hi,

i want to move a MatrixTransform (mt) with animation.
I dont want to generate an new pat or something like this under the mt.
When i directly animate the mt with

Code:

osg::Vec3d startAnimationVec = mt-getBound().center();
osg::Vec3d endAnimationVec = startAnimationVec + osg::Vec3f(0.0f,2.0f,5.0f);
osg::ref_ptrosg::AnimationPath animationPath = new osg::AnimationPath();

animationPath-setLoopMode(osg::AnimationPath::NO_LOOPING);
animationPath-insert(0, startAnimationVec);
animationPath-insert(1, endAnimationVec);

osg::ref_ptrosg::AnimationPathCallback animationPathCB = new 
osg::AnimationPathCallback(animationPath.get(), 0.0, 2.0);
animationPathCB-setAnimationPath(animationPath.get());
mt-setUpdateCallback(animationPathCB.get());




the movement is correct but the the other values in the mt are erased.
So before the animation the Matrixd of the mt look like 

Code:
(a,b,c,x,
d,e,f,y,
g,h,i,z)


and afterwards 

Code:
(1,0,0,x,
0,1,0,y,
0,0,1,z)



How can i animate without losing the matrix?
Thank you!

Cheers,
Andrew

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35507#35507





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] animated moving of a MatrixTransform

2011-01-11 Thread Tom Pearce
Hi Andrew,

Using the OSG's animation features isn't something I've done personally, so I 
can't say if this would work or not.  However, what I'd do is subclass 
osg::AnimationPathCallback to make it handle the matrix the way you want.  
Whether that means saving the original matrix and restoring some or all 
elements at the end of the animation, or only letting it change certain values, 
that would be up to you.

Cheers,
Tom

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35534#35534





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org