[ODE] Player camera

William Denniss william.denniss at omegadelta.net
Wed Sep 15 09:59:19 MST 2004


Hi,

Not quite sure if this is what you have in mind, but I believe I use a 
similar concept in my game.

I have a Geom (in a GeomTransform) attached to the body which I call 
the ChaseTarget.  It is not attached to any Space, so does not collide 
and it's always at a set distance from the Body (off topic, as I define 
it in XODE, it makes it very simple to move the camera around - no 
recompile necessary).

I have a ChaseCam which is always trying to catch the ChaseTarget and 
its coordinates are the ones used for the OpenGL view.  The beauty of 
it is that the ChaseCam only starts chasing when the target moves 
outside a certain threshold - so there is not jitter.  Additionally, 
the further the ChaseTarget is from the ChaseCam, the faster it chases 
(to avoid tiny movements, I also have a minimum amount it can move when 
it moves).  So each frame the ChaseCam moves in the direction of the 
ChaseTarget, an amount which depends on the distance between them and 
is always greater than a minimum amount.  This gives a nice effect in 
that when the vehicle is moving slowly, the camera is right behind, but 
when it speeds up, it moves back a bit so you can see move of the scene 
(important when going faster).  Because the camera is not locked to the 
geometry, things like bounces and jitter just average out and you are 
left with a very smooth camera path.  The idea is fairly simple, you 
just need to spend a while tweaking the values to get the desired 
effect.

In your case, you mention your object can jump up and down.  So long as 
you set the correct threshold on the vertical axis, the camera can 
ignore these movements.  Sometimes (if I drive too fast - I don't yet 
limit the acceleration) my vehicle can go bouncing around all over the 
place at a crazy speed - the camera however keeps it's distance and is 
nice and smooth.

Cheers,

Will.


On 15/09/2004, at 4:10 AM, Pierre Renaux wrote:

>
> Hello,
>
> I'm trying to find informations to make a simple Quake type sliding 
> player
> camera using ODE.
>
> I tried to google and look through the mail archive, and I cant find 
> any
> relevant infos.
>
> The main problem I have is that I cant really get rid of the bouncing.
>
> Otherwise my system works pretty well, with boxes, and trimeshes 
> bouncing
> properly :P
>
> Now I just need this simple sliding camera to work.
>
> Thanks,
> - Pierre
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
>



More information about the ODE mailing list