I'm trying to find a way to pause the physics simulation, but it looks like at present I'm going to have to iterate through all bodies and set their velocities/torques manually (and store these so I can un-pause!).
While digging around, I found this solution by another project using Bullet.
Little bit later: this seems to work with minor hacking to world.monkey2 as below:
If Keyboard.KeyHit (Key.P)
Game.GameScene.World.TimeScale = Not Game.GameScene.World.TimeScale
Endif
... and it pauses/unpauses nicely. Can even do super slowmo and that seems to work well too!
If Keyboard.KeyHit (Key.Minus)
Game.GameScene.World.TimeScale = Game.GameScene.World.TimeScale * 0.5
Endif
(Actually, looks like I need to store timescale before pausing, as Not timescale always restores to 1.0 regardless of reduced scale before Not timescale.)
Original Author: DruggedBunny
I'm trying to find a way to pause the physics simulation, but it looks like at present I'm going to have to iterate through all bodies and set their velocities/torques manually (and store these so I can un-pause!).
While digging around, I found this solution by another project using Bullet.
Little bit later: this seems to work with minor hacking to world.monkey2 as below:
... then in my game I just call:
... and it pauses/unpauses nicely. Can even do super slowmo and that seems to work well too!
(Actually, looks like I need to store timescale before pausing, as Not timescale always restores to 1.0 regardless of reduced scale before Not timescale.)