Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Collision.gameObject does not return the collider of the collision

Discussion in 'Physics' started by bourriquet, Aug 4, 2020.

  1. bourriquet

    bourriquet

    Joined:
    Jul 17, 2012
    Posts:
    181
    The documentation states: "The GameObject whose collider you are colliding with."
    Yet, if the collider has a parent with a Rigidbody, this parent will be returned instead of the colliding collider. In this case Collision.gameObject and Collision.collider don't return the same game object.
    Is that the expected behavior or a bug? If it's expected, why is it not mentioned in the documentation?