Does Unity Multi-Scene physics support rigid body interpolation for additional scenes? If not, is this capability on the roadmap?
It looks like it needs to be enabled manually. Still testing, but I think this will work:
using UnityEngine;
public class PhysicsSceneConfiguration : MonoBehaviour
{
public bool PhysicsSimulationEnabled;
private PhysicsScene _PhysicsScene;
private bool _IsValid;
private void Awake()
{
_PhysicsScene = gameObject.scene.GetPhysicsScene();
}
private void Update()
{
if (_PhysicsScene != null && PhysicsSimulationEnabled)
{
if (!_IsValid)
_IsValid = _PhysicsScene.IsValid();
if (_IsValid)
_PhysicsScene.InterpolateBodies();
}
}
private void FixedUpdate()
{
if (_PhysicsScene != null && PhysicsSimulationEnabled)
{
if (!_IsValid)
_IsValid = _PhysicsScene.IsValid();
if (_IsValid)
{
_PhysicsScene.ResetInterpolationPoses();
_PhysicsScene.Simulate(Time.fixedDeltaTime);
}
}
}
}
1 Like
Very good solution, I didn’t know about this!
The documentation includes a simpler example, which assumes the ideal situation (no verifications):