Page 1 of 1

Newton problem when reloading level

Posted: Thu Sep 07, 2006 7:31 pm
by goutbouyo
Hi,
I have a big problem with Newton ...

When I start my game, my object falls on the floor directly.
But when I stop my game(in order to restart the level) my object doesn't fall directly on the floor.
With 1 restart, I must shoot on it 1 second and he falls.
With 2 restart 2 secconds, with 3 restarts 4 seconds ...

I use this functions to release Newton:

NewtonDestroyAllBodies(nWorld);

// release the collision tree
NewtonReleaseCollision(nWorld, g_newtonmap);

for (int i=0; i<numNewtonObject; i++)
NewtonReleaseCollision(nWorld, newtonObject->collision);

// destory the newton world object
NewtonDestroy(nWorld);


Can you help me please ???

Posted: Fri Sep 08, 2006 1:27 am
by Acki
Maybe a Newton forum can help you !?!?!

Posted: Sat Sep 09, 2006 9:38 am
by goutbouyo
I found the problem :

Code: Select all

//NEWTON		
// Update newton 100 times / second
if (device->getTimer()->getTime() > lasttick + 10)
{	
	lasttick = device->getTimer()->getTime();
	NewtonUpdate(nWorld, 0.01f);
}
lasttick was not reinitialized at the restart, so the newton world was not updated directly.

I add that at the restart :
lasttick=0;

And now it's working !!!