Timercontroller advance having no effect on bodies

tertle

09-02-2010 01:21:14

I never noticed this in my project until I did a release, but my bodies move at different speeds depending on the frame rate. think this was master branch

I create 50 randomly positioned boxes in the air which fall to the ground.

#define BOXNUM 50
OGRE3DBody* mCube[BOXNUM];

srand( (unsigned)time( NULL ) );

for(int i=0;i<BOXNUM;i++)
mCube[i] = mRenderSystem->createBody(new NxOgre::Box(1, 1, 1), NxOgre::Vec3(Ogre::Math::RangeRandom(-50,50), Ogre::Math::RangeRandom(100,400), Ogre::Math::RangeRandom(-50,50)), "cube.1m.mesh");


Then update them every frame with

mTimeController->advance(deltaTime);

where deltaTime is time since last frame in seconds. I've verified that this value is correct. It's of type double, but that shouldn't matter right...?

Higher the fps faster the faster they fall.
Changing deltaTime seems to have no effect on the speed at which they fall.
If I keep the framerate the same, and feed advance different static values to test, the blocks fall at the same speed.
They don't fall without advance() being run.

Any advice? I thought that this would be pretty key so I'm surprised it's not working for me. Am I missing something fundamental?

LucaMoller

09-02-2010 19:11:17

I guess this is about what Betajaen just talked in the other topic:
viewtopic.php?f=6&t=12075
Okay, I just looked in the source for you.

- BloodyMess ignores the deltaTime value (It has it's own timer).
- Detritus uses what you give.

You should upgrade to Detritus.

I think it explains what you described.

betajaen

09-02-2010 19:47:46

Also as we should all know heavier bodies do not fall faster than lighter ones, so regardless of the frame rate the rate of fall for all bodies should be consistent.

tertle

10-02-2010 01:03:12

Upgrade I shall then, thanks.