Hi Robert,

On Wed, Oct 19, 2011 at 8:42 PM, Robert Kern <[email protected]> wrote:
> I have a positionAttitudeTransform node that I've put an animation path 
> callback function on. As the object is moving I need to know its position. I 
> can see my object moving in my scene however when I call 
> positionAttitudeTransform::getPosition() it always returns the coordinates 
> (0,0,0). How can I get the position of my object?

The getPosition() should work fine as the AnimationPathCallback
explictly sets this, the code from src/osg/AnimationPathCallback.cpp
that does the updating is:

        virtual void apply(PositionAttitudeTransform& pat)
        {
            if (_useInverseMatrix)
            {
                Matrix matrix;
                _cp.getInverse(matrix);
                pat.setPosition(matrix.getTrans());
                pat.setAttitude(_cp.getRotation().inverse());

pat.setScale(osg::Vec3(1.0f/_cp.getScale().x(),1.0f/_cp.getScale().y(),1.0f/_cp.getScale().z()));
                pat.setPivotPoint(_pivotPoint);

            }
            else
            {
                pat.setPosition(_cp.getPosition());
                pat.setAttitude(_cp.getRotation());
                pat.setScale(_cp.getScale());
                pat.setPivotPoint(_pivotPoint);
            }
        }


So if the object is animating correctly then the Position will be set.
 So if you aren't see any change I would recommend double checking
that you are reading the correct node, or adding setting a break point
into the AnimationPathCallback::apply(..) method to double check that
running correctly.

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

Reply via email to