You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
705 B
C#
24 lines
705 B
C#
using Fusion;
|
|
using UnityEngine;
|
|
|
|
namespace Projectiles
|
|
{
|
|
public class SimulatePhysicsMultipeer : SimulationBehaviour
|
|
{
|
|
private void FixedUpdate()
|
|
{
|
|
if (Runner == null || Runner.IsRunning == false)
|
|
return;
|
|
|
|
// In multi-peer mode the physics scenes are not simulated by default. This can be solved by
|
|
// adding Fusion Physics Addon but in case physics simulation is not part of the Fusion simulation
|
|
// it is enough to simulate physics like this. In this sample we use physics for the flying cap visuals.
|
|
if (Runner.Config.PeerMode == NetworkProjectConfig.PeerModes.Multiple)
|
|
{
|
|
var scene = Runner.GetPhysicsScene();
|
|
scene.Simulate(Time.fixedDeltaTime);
|
|
}
|
|
}
|
|
}
|
|
}
|