void OnCollisionEnter(Collision collision) { Body b = collision.gameObject.GetComponent <Body>(); //If the distance between the surfaces of the two bodies is less than a certain thing then don't show effects if ((oldPos - b.oldPos).magnitude - transform.localScale.x / 2 - b.transform.localScale.x / 2 < 10f) { return; } float impactForce = Vector3.Dot(collision.contacts[0].normal, collision.relativeVelocity); if (impactForce > 50) { ParticlesManager.PlaySystem(collision.contacts[0].point, (int)impactForce, impactForce); } }