[osg-users] NodeTrackerManipulator doesn't appear to track transform nodes correctly?
Dickinson, Alan J.
ALAN.J.DICKINSON at saic.com
Wed Jul 9 10:21:27 PDT 2008
I have been working with the NodeTrackerManipulator class to follow a
PositionAttitudeTransform node. When I setTrackerNode() for the
PositionAttitudeTransform node everything appears to configure fine
except the resultant center postion is incorrect for nodes which have
there own transformation. The computeNodeCenterAndRotation calculates
the localToWorld coordinates for this node which is the same as the
bounds center for the node itself. Therefore the nodeCenter is equal to
its transformed center multiplied by localToWorld again. I was able to
fix the code for my case by changing:
osg::Node *node = _trackNodePath.back().get();
// Check if node is a transform node and just use its already
osg::Transform* trans = dynamic_cast<osg::Transform*>(node);
nodeCenter = osg::Vec3d(trans->getBound().center());
nodeCenter = osg::Vec3d(0.0f,0.0f,0.0f)*localToWorld;
This seems to work for my case but I don't know if this will work for
all other cases.
Should I modify the NodeTrackerManipulator class and submit the change
via the submissions process or would somebody like to take a look at
this and see if this works for all appropriate cases then submit the
Thanks for you support on a great product.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users