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.
Then update them every frame with
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?
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?