Hey everyone.

I may be interpreting how this is done improperly, but all I want at the moment 
is to animate two hand models.  

I have two osg::MatrixTransform objects which I add my loaded hand models too.

I then attach an instance of a class that extends from osg::NodeCallback

Then in that class i have: 


Code:

public:
        HandMovementX() :incrementer(-0.5), incrementer2(-0.5), pitch(-90.0), 
roll(12.0){}

        virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
        {

                OSG_FATAL << "Being called" << std::endl;
                roll += incrementer2;
                if (roll > 57)
                        incrementer2 = -0.5;
                if (roll < -33)
                        incrementer2 = 0.5;

                pitch += incrementer;
                if (pitch < -135)
                        incrementer = 0.5;
                if (pitch > -90)
                        incrementer = -0.5;

                
                osg::MatrixTransform *trans = dynamic_cast<osg::MatrixTransform 
*> (node);
                if (trans != NULL)
                {
                        osg::Matrixd handRotation;
                        handRotation.makeRotate(
                                osg::inDegrees(90.0f), osg::X_AXIS,
                                osg::inDegrees(pitch), osg::Y_AXIS,
                                osg::inDegrees(roll), osg::Z_AXIS
                                );
                        trans->setMatrix(handRotation * 
osg::Matrix::translate(15, 0, 8) );
                        worldCoordMatrix = 
osg::computeLocalToWorld(nv->getNodePath());

                }
                traverse(node, nv);
        }

private:
        osg::Matrix worldCoordMatrix;
        float pitch;
        float roll;
        float incrementer;
        float incrementer2;





The hands are moving, but not at all how I want them too and it seems that it 
animates first the Y axis and then the Z axis and then the translate.  I want 
all positions to be taken into account in a single movement on each frame. Am I 
approaching this totally wrong or what?

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





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

Reply via email to