Skip to main content

State-based Physics (Beta)

The state-based physics feature is currently in Beta.

Luna Replay captures user input during the time of recording, in order to replay the same sequence of events at a later time.

Many games rely heavily on specific physics behaviour during gameplay (i.e. how a character moves, how two objects interact), so therefore the ability to replay this behaviour precisely is extremely important. Imagine two objects colliding with slightly different rotations; from that moment on, the gameplay could differ meaning that any recorded input will gradually diverge from what is happening in the scene.

This issue typically arises due to the nature of Unity's game engine; PhysX has limited determinism, especially when changing platforms i.e. recording on iOS, replaying on Linux on Luna Playground.

Enable state-based physics#

In order to avoid such occasions, Luna Replay supports state-based physics captures and replays.

The positions of RigidBodies are saved during a capture, and used to overwrite the positions frame-by-frame during a replay.



When to use it?#

If you notice differences in physics between your captures and replays, then it is recommended that you try this feature.

However, please note, physics differences may be the result of different issues with the project, such as randoms.

State-based physics API#

Find out more on this here.

Capture Collisions#

It is recommended to enable this option if you are working with State-based Physics.

Enabling the Capture Collisions option will allow Luna Replay to store all calls to the following methods during the Capture phase: OnCollisionEnter, OnCollisionStay, OnCollisionExit, OnTriggerEnter, OnTriggerStay, & OnTriggerExit.

During the Replay phase the behaviour changes to ignore these calls when triggered by Unity, and instead calls them manually using the same order they were called during the Capture. This will allow for collisions in your Replay to be 1-1 with how they occurred in Unity.

This option cannot be enabled without State-based Physics also being on, as it is a prerequisite.