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

2008-07-09 Thread Dickinson, Alan J.
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(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

 

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] AnimationPathCallback timeMultiplier

2008-09-03 Thread Dickinson, Alan J.
I have been creating an animation controller which allows the user to
start, stop and reset the animation being visualized in OSG. I have
added speed control keys which allow the user to speed up or slow down
the simulation by changing the timeMultiplier value in the
AnimationPathCallback class.

 

When I hit the speed up key it changes the timeMultiplier by a small
amount say 0.05 from the default 1.0 like it should.  But each time I
hit the speed up key the position of the object being animated jumps
ahead more than the small amount the speed up should be. When I hit the
slow down key which subtracts 0.05 from the default 1.0, the position of
the object jumps backwards in the path. Then continues from that point
on at the slower speed.

 

Is this the correct behavior? 

 

It does change the speed of the animation either faster or slower but
the position is jumping at the transition. If I hit the slow down key
enough I can go back to the beginning of the path. 

 

What am I doing wrong? Or is there a different way to control the speed
of an animation ?

 

Thanks,

 

Alan Dickinson

SAIC Intelligent Systems Applications Division

Sr. Software Engineer

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] AnimationPathCallback timeMultiplier

2008-09-04 Thread Dickinson, Alan J.
Hi Ulrich and Robert,
 
I agree with you Ulrich. I have been looking at the getAnimationTime
method which uses an absolute time calculation instead of a relative
delta time approach. I am working on adding a _prevTime instance
variable to the operator() method to save the _latestTime from the
previous timestamp. Then calculate the animationTime as you suggested. 
 
Not sure how the timeOffset is suppose to work. In the original absolute
formula it is subtracted from the ((Tlast-Tfirst) - timeOffset) *
timeMultiplier but that seems to be a negative offset. Is this the
correct interpretation or am I missing the intent of the timeOffset.
 
Also I am in the process of adding the ability to single step the
animation while it is paused. I think I need to change the pauseTime by
my stepSize to make this happen but I need to fix the getAnimationTime
method first. 
 
How do I force the animation to redraw while it is paused with the new
pauseTime value?
 
FYI: I have been working with both 2.4 and 2.6 released versions
currently...
 
Thanks again for your help,
 
Alan
 
>Hi Alan and Robert,
 
>Robert Osfield wrote:
>> The sounds very much like a bug where the pause code is being broken
>> by changes in the multiplier.  Have a look at the
>> AnimationPathCallback implementation to see if you can spot what
might
> amiss.
 
>I believe this behaviour is due to the way the animation time is
calculated.
 
>It's not incremental (t += dt * timeMultiplier) which would be
continuous when the
>multipler changes, but absolute (t = (Tlast - Tfirst) * timeMultiplier)
which will jump
>when you change the multiplier.
 

 

 

Alan Dickinson

SAIC Intelligent Systems Applications Division

Sr. Software Engineer

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org