Camera jittering tracking newton body

Kim2

24-10-2008 23:20:11

I'm having a huge jittering problem with my game, the moment the FPS deviates by ten or so from the desired_frame_rate value the camera goes spastic and shakes around. I've read all the threads about this I can find and it seems that the solution as explained by Walaber is to update the camera inside the newton update loop but even after looking at the stunt playground source I don't understand how to do this.

The key seems to be the deltat value being sent to the followcamera update function... can somebody please explain how this all fits together so that the camera doesn't jitter?

MainFrameListener::MainFrameListener(RenderWindow* win, Camera* cam, SceneManager* mgr, FollowCamera* follow, OgreNewt::World* world, int desired_fps ) :
WalaberOgreFrameListener(win)


Just looking at this code... how does Ogre know to render the scene with the followCamera and not the other one (cam)?

I'm just passing a single camera to a framelistener in which I execute all game logic and the newton world update, is there a way to update the camera inside the framelistener so I get the same smooth tracking as in Stunt Playground without needing a custom camera class?

mNewtonListener = new OgreNewt::ProjectNewtonFrameListener( mWindow, mCamera, mSceneMgr, mRoot, msnCam, m_World, 60);
mRoot->addFrameListener(mNewtonListener);


I really appreciate any help, this is very frustrating!

Kim2

25-10-2008 08:50:05

OK, I've seen that the followcamera gets passed the camera to use when it's initialized. I still hope somebody can explain how it achieves smooth movement using the deltat value.

EDIT: I'm using the followcamera class now and it's working nicely but I'd love to know why!

terrykim426

27-10-2008 16:32:01

Hi, im having the same problem. May i know how u solve the jittering problem? Im using the followcamera as well.

Thx in advance

Kim2

29-10-2008 20:34:04

Well I just used the followcamera class from Stuntplayground and it seems to work smoothly most of the time but occasionally (especially if the objects are moving at very high speeds, which they are in my game because I'm messing around with realistic spaceships) it still jinks out a bit.

terrykim426

30-10-2008 08:26:21

Im using the stuntplayground's followcamera class too. But it will still jitter abit after every 1-2sec.

But thanks anyway :)

Kim2

04-11-2008 14:05:47

If you find a solution to this please post it here or pm me about it, this problem is making me consider converting my project to use physx.