"George Bekos" writes:

> Hello OSGers!
>
> The last days I am playing with osgAnimation in order to implement something. 
> I managed to make something work like I want it to but I don't know if this 
> is the right approach or not. I will describe my problem and then I will 
> describe my solution. I would be more than grateful if you could give my 
> suggestions,advices,tips etc.
>
> Problem:
> I have a skinned (it has a skeleton, it is based on bones) hand model in a 
> DAE file. The model does not contain any keyframes or animation.
> I want to import this hand into my OSG application and be able to move the 
> fingers independently using the k/b. The movement of the fingers is simple: 
> only rotation around an axis. (have your palm wide open and try to make a 
> fist, each finger rotates around one axis that passes through the joint).
>
> Solution:
> * I load the model normally.
> * I get a pointer to a bone(using an osg::NodeVisitor).
> * I get osgAnimation::UpdateBone callback for that bone
> * I get get the osgAnimation::StackedTransform from that 
> osgAnimation::UpdateBone
> * I push_back() a new osgAnimation::StackedRotateAxisElement  (I also store 
> the pointer somewhere else) to the osgAnimation::StackedTransform
> * Then I pass (using the constructor) the previous stored 
> osgAnimation::StackedRotateAxisTransform pointer to a custom EventHandler 
> that inherits from osgGA::GUIEventHandler and I add it (the handler) to the 
> osgViewer (using addEventhandler()).
> * Then inside the handler() function of my custom even handler I check for 
> key presses and then I modify the angle of the 
> osgAnimation::StackedRotateAxisTransform.
>
> All the above seem to work fine, but I don't know if this is the right way to 
> solve this kind of problem. I would appreciate any 
> comments/suggestions/ideas/tips.
>
> Thank you very much for your time!

Hi George,

if you are directly moving a bone, you could bypass all the
transformation system and just replace its update callback with one of
yours that should compute the bone position in skeleton space. Check the
original osgAnimation::UpdateBone for details.

-- 
Alberto

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

Reply via email to