Skip to content

Commit

Permalink
hopefully fixes a few errors in online multiplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
fragmental committed Apr 24, 2017
1 parent bf5c3e8 commit 8be5dcb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Assets/scripts/entity/Ball.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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")
{
Expand Down

0 comments on commit 8be5dcb

Please sign in to comment.