Jump to content

[SOLVED] Some issues about physics.saveScene(), physics.restoreScene() and BodyFracture


photo

Recommended Posts

When we want to do something like backward rewind, we get some problems with BodyFracture (& potentially created/removed bodies). When we do rewind, all is ok, but crack pieces are still enabled & we can`t get it work propertly using script.

 

I have some notes about how to do it right modifying physics.saveScene() & physics.restoreScene() logic:

1. We need to save body enabled/disabled state.

2. When actual scene has no physics body, but we want to restore scene which contains it, we need to ignore such bodies (now it crashes engine).

3. When we make restoreScene, we need to disable bodies, which is not exist in savedScene.

 

To make this system more flexible, it can be possible to make some parameters (ignore / warning / create not existing, disable / remove not saved, compress freezed bodies (may be this needs to ignore performance optimizations)).

 

Also i want to have some functions like saveScenesToFile. I think there is way to discard info about freezed bodies to reduce file size. This will be very useful for creating replay files. For now there is one way to do replay using save/restore state mechanism, and i think it is perfect way because of simplicity. But problem is in size of file which this system produce - it is not useful, direct video capture can be smaller size :D

Link to comment
  • 1 year later...
  • 1 month later...
×
×
  • Create New...