#What is a recommended way to handle Offline non-predicted rigidbody?

1 messages · Page 1 of 1 (latest)

tropic grove
#

Is this example a good way:

        extraScene = SceneManager.CreateScene("Scene", new CreateSceneParameters(LocalPhysicsMode.Physics3D));
        SceneManager.MoveGameObjectToScene(m_MyGameObject, SceneManager.GetSceneByName(extraScene));

Is calling SceneManager.MoveGameObjectToScene resource intensive? Especially if it is called frequently, e.g to spawn local visual only projectiles at a quick/frequent rate?

The reason why I'm doing this is because the Physics.Simulate is being called on the main scene. My offline bullets on the local client is moving faster even though it has the same velocity as the same projectile on the host player. I'm assuming Physics.Simulate is the cause of this discrepancies. Hence I'm assuming I should run all offline rigidbodies in a separate physics scene (correct me if I'm wrong).

brisk bramble
#

You'll have use the Profiler to check this. I've never needed to move Gameobjects between scenes.

Regarding your physics discrepancy, it should be frame rate independent unless you are calling Simulate() manually.

tropic grove
#

I'm wondering if there's a way to set offline rigidbodies to be only affected by the standard auto physics simulation

brisk bramble
#

No, I don't think you can change the physics mode per object.

#

You might want to try using NetworkTime.FixedDeltaTime instead of Time.deltaTime