[ODE] Camera Questions Again

David Walters hidden.asbestos at googlemail.com
Mon Sep 18 01:54:32 MST 2006

> Hi everybody
> I want to follow with my camera a moving body. The lookup point is the
> center of mass of the body. The camera have to be
> always behind the body even when the body rotates. I have tried everything
> that i found in the threads, but my camera is placed
> always on the wrong place. Can i determine where the camera should be, only
> using the body position and rotation. Can somebody give me a
> formula or  link to tutorial or something like that.

This isn't really physics related more of a maths question, but the
simple solution is the take the rotation matrix of the follow object.
Use the forward axis vector ( usually column 2 of the matrix )
multiplied by some negative distance factor, added to the position of
the follow object.

That should be a position 'distance' units behind the follow object.
Note that you probably want to output the forward vector, follow
position and camera position as you fly around, because there's a very
good chance I should have said 'row' instead of 'column' and your
camera might fly off in some other direction when you turn.

Still, that's the theory behind it.


More information about the ODE mailing list