/// <summary> /// /// </summary> /// <param name="other"></param> private void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Player") { // Getting the Player Rigidbody2D PlayerMover player = other.gameObject.GetComponent <PlayerMover>(); Vector2 lastVelocity = player.GetLastVelocity(); // IF debug is on, then print the player's velocity if (debug) { Debug.Log("\tlastVelocity.magnitude:" + lastVelocity.magnitude); } // IF the player's velocity exceeds the break velocity... if (lastVelocity.magnitude >= breakVelocity) { BreakBarrier(); } } }