From 8be5dcb86585df6003b7bb9891d7a7af1a55b492 Mon Sep 17 00:00:00 2001 From: Stewart Martin Date: Mon, 24 Apr 2017 07:03:14 -0500 Subject: [PATCH] hopefully fixes a few errors in online multiplayer --- Assets/scripts/entity/Ball.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Assets/scripts/entity/Ball.cs b/Assets/scripts/entity/Ball.cs index 5d4e563..0093652 100644 --- a/Assets/scripts/entity/Ball.cs +++ b/Assets/scripts/entity/Ball.cs @@ -32,11 +32,13 @@ private void FixedUpdate() if (rigidBody.velocity.magnitude < minimumVelocity) { - rigidBody.velocity *= minimumVelocity / rigidBody.velocity.magnitude; + //added a ver small number to keep from dividing by zero + rigidBody.velocity *= minimumVelocity / rigidBody.velocity.magnitude + 0.000000001F; } if (rigidBody.velocity.magnitude > maximumVelocity) { - rigidBody.velocity *= maximumVelocity / rigidBody.velocity.magnitude; + //added a ver small number to keep from dividing by zero + rigidBody.velocity *= maximumVelocity / rigidBody.velocity.magnitude + 0.000000001F; } } @@ -105,6 +107,9 @@ void OnTriggerEnter(Collider Col) void OnCollisionExit(Collision other) { + // Only handle ball force server-side of local + if (NetworkManager.singleton.isNetworkActive && NetworkServer.connections.Count == 0) return; + if (other.gameObject.tag == "Paddle" || other.gameObject.tag == "Bumper") {