Jump to content

Easiest way to accurately play back physics interactions...


photo

Recommended Posts

Posted

I'm trying to implement a replay system that accurately replays the player's last action when the level is completed. The problem is that the physics in the replay have to be exact, otherwise it may end up not being displayed as a completed level. I've gotten the replay to work somewhat well (able to reset all objects to their positions and angular/linear velocities), but for levels with explosions and larger stacks of rigid body objects, the replay tends to be inaccurate to the point where the result often doesn't meet the level complete condition.

 

So I'm wondering, is there some method to guarantee 100% accurate replaying of physics interactions?

Posted

Have you tried engine.physics.saveScene() & engine.physics.restoreScene()?

 

https://developer.unigine.com/en/docs/1.0/code/scripting/library/engine/engine.physics#engine.physics.saveScene

https://developer.unigine.com/en/docs/1.0/code/scripting/library/engine/engine.physics#engine.physics.restoreScene_int

 

See also SDK samples physics/reverse_00, physics/reverse_01 and physics/reverse_02

 

Using a modified version of that method works perfectly. Thank you!

×
×
  • Create New...