[osg-users] NodeTrackerManipulator doesn't appear to tracktransform nodes correctly?

Vican, Justin E. jvican at draper.com
Wed Jul 9 10:48:37 PDT 2008


Hi Alan,

On a related topic, I have noticed that setting the track node to a
model with variable geometry (i.e. a model with a particle emitter)
causes the focus point to jump around a lot.  I generally insert my
loaded models into PositionAttitudeTransform nodes, and focus the node
tracker on the PAT node.  If the underlying model sub-graph has variable
geometry (particle emitters in my case), the model appears to jitter.  I
believe this is because the center of the bounding sphere is moving due
to the particles.

 

If we are going to modify the NodeTrackerManipulator as suggested below,
would it benefit anybody else to allow the tracker to focus on the
position of the PAT node rather than the center of the bounding sphere?
Just a thought.

 

Thanks,

Justin

 

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of
Dickinson, Alan J.
Sent: Wednesday, July 09, 2008 1:21 PM
To: osg-users at lists.openscenegraph.org
Subject: [osg-users] NodeTrackerManipulator doesn't appear to
tracktransform nodes correctly?

 

Hello,

 

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:

 

Method computeNodeCenterAndRotation()

 

THIS:

    if (validateNodePath())

    {

nodeCenter =
osg::Vec3d(_trackNodePath.back()->getBound().center())*localToWorld;

    } 

 

TO

 

 

   if (validateNodePath())

   {

      osg::Node *node = _trackNodePath.back().get();

 

      // Check if node is a transform node and just use its already
transformed center 

      osg::Transform* trans = dynamic_cast<osg::Transform*>(node);

      if(trans)

            nodeCenter = osg::Vec3d(trans->getBound().center());

      else

            nodeCenter =
osg::Vec3d(node->getBound().center())*localToWorld;

       }

   else

        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
change.

 

Thanks for you support on a great product.

 

Alan Dickinson

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080709/e429a329/attachment-0003.htm>


More information about the osg-users mailing list