Hi Rabbi,

The NodeTrackManipulator is designed to allow user interaction, rather
than be fixed.  For you own purpose it's most likely that you'll want
to control the view matrix yourself, there are a range of ways of
doing it, since it's your application I can't guess at your particular
ideas on how you'd like the camera that is doing the following to
behave.  The best I can do is suggest the parts of the OSG that would
help you get the information you need.

First up you need the to compute the local to world transformation
matrix that positions the object in your word.  You can use the
node->getWorldMatrices() method to give you a list of matrices.
Typically it'd be just one matrix, but if you node has multiple
parents (or it's parent might have multiple parents) that it'll give
you multiple matrices one for each parental path so you code should
double check the size of matrix list you get back.

Then you need to compute view matrix for the camera, and this will be
the inverse of the local to world matrix above, use Matrix::invert()
to do this.  Next up you'll want to move the camera back by applying
another matrix.  Exactly what extra movement you'd want I can say -
this is your app, you need to decide.

Once you have the final view matrix then just apply it to the
view(er)'s master Camera on each new frame.  You can apply the view
matrix using a camera manipulator like the NodeTrackerManipulator does
(the viewer will pull the view matrix from the camera manipulator on
each new frame).  Or if you don't want to go the camera manipulator
route then you could use a update callback on the Camera, or just set
in within the frame loop.


Robert.

On Fri, May 15, 2009 at 8:22 PM, Rabbi Robinson <[email protected]> wrote:
> Hi,
>
> I am using NodeTrackerManipulator in my application to follow a node. I would 
> like NodeTrackerManipulator to be fixed in the followed node coordinate. e.g. 
> the camera always follow a character, but always some distance behind it and 
> looking forward in the character's coordinate. Can someone show me how it can 
> be done? Thanks
> Thank you!
>
> Cheers,
> OSG
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=12299#12299
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to