Restarting the Simulation?

tomjscott
Posts: 2
Joined: Mon Mar 10, 2014 4:06 am

Restarting the Simulation?

Post by tomjscott »

How do you restart the simulation so that all the objects are reset to their original position? Is there a function for this or do I have to do this manually by storing the original positions and reset them for all objects?
bwelch
Posts: 48
Joined: Thu Dec 12, 2013 4:04 pm

Re: Restarting the Simulation?

Post by bwelch »

I guess it depends on how you're using Bullet. I believe in many of the demos, they use an InitPhysics() and ExitPhysics() function, and I think spacebar is tied to them to reset the simulation. You might want to check there for inspiration.
tomjscott
Posts: 2
Joined: Mon Mar 10, 2014 4:06 am

Re: Restarting the Simulation?

Post by tomjscott »

bwelch wrote:I guess it depends on how you're using Bullet. I believe in many of the demos, they use an InitPhysics() and ExitPhysics() function, and I think spacebar is tied to them to reset the simulation. You might want to check there for inspiration.
Yep. I started looking at those demos more closely and found that. It does answer my question. It basically means I have to kill the whole thing, cleanup all objects and then re-create and init all objects. So, I went ahead and did that and all is well.

I'm starting to get a better grip on the engine and things are looking up.