Simulating a smooth 'mouselook camera' with a body...

Zeal
Posts: 47
Joined: Thu Oct 18, 2007 6:49 am

Simulating a smooth 'mouselook camera' with a body...

Post by Zeal »

As im sure you all know, its very difficult to get smooth rotation out of your camera when your fps is jumping all over the place. I wrote a special camera class that works (using a fixed time step), but its overly complicated. The other day I was thinking, couldnt I use Bullet to simulate my camera movement/rotation?

What im trying to do is get Bullet to handle all the rotation of my camera when the user moves the mouse. So for example, if the mouseMove.x > 0 then addSomeAngularRotationalForce?() to the 'dummyCamBody'. Then I could just set my camera to the same transform as the body.

This angular roational force would have to have some cap (so the camera doesnt spin out of control), as well as some cap on the x axis (at 90 degrees, so the user cant do a backflip). Since Bullet runs on a fixed timestep, I imagine this would result in perfectly smooth camera movement/rotation, right? However im a little fuzzy on how to implement somethign like this (dont have much experience with 'rotational forces', ect...). Can anyone give me some tips/provide some code?

Thanks!
Zeal
Posts: 47
Joined: Thu Oct 18, 2007 6:49 am

Re: Simulating a smooth 'mouselook camera' with a body...

Post by Zeal »

Dont you guys use Bullet to help with smooth rotations like this? It just seems silly to write a special camera class with its own 'mini physics', timestep, ect... just to get smooth mouselook...