Question by
thanathos91 · Jun 17, 2017 at 05:55 PM ·
unity 5collisionnetworkingmultiplayerdelay
Network collision delay problem
Hi there! I've a problem with collision replication. When i play in local it work correctly, but if I play in multiplayer I've this problem. Collision in network seems to have a delay:
void OnCollisionEnter(Collision other)
{
ReceivePush(direction*force);
}
public void ReceivePush(Vector3 pushForce)
{
Debug.Log ("receive pushing");
if (!isServer)
{
CmdReceivePush (pushForce);
}
else
{
rigidBody.AddForce (pushForce, ForceMode.Impulse);
}
}
[Command]
public void CmdReceivePush(Vector3 pushForce)
{
Debug.Log ("CmdReceivePush");
rigidBody.AddForce (pushForce, ForceMode.Acceleration);
}
[ClientRpc]
public void RpcAddForce(Vector3 pushForce)
{
rigidBody.AddForce (pushForce, ForceMode.Acceleration);
}
In multiplayer match we receive collision after 0.5s, it seems wrong behavior, because add force is not immediately. Movement replication and rotation works great (i have also increased sendRateInterval of networkBehavior script settings).
Comment