public void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("PlayerBottom")) { Vector3 playerVel = collision.attachedRigidbody.velocity; float sign = playerVel.x >= 0.0f ? 1.0f : -1.0f; Vector3 newDir = sign * direction.normalized; _fullRail.PlayerCollidesRailPart(newDir); } }