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

Preventing collider from glitching through terrain

Discussion in 'Physics' started by Maarti, Sep 29, 2019.

  1. Maarti

    Maarti

    Joined:
    Sep 3, 2016
    Posts:
    5
    Hello,

    I'm using a terrain in Unity 2019.2.1f1 and a custom mesh of a cave with a mesh collider.

    My character that has a Capsule Collider way bigger than the entry of the cave should not be able to enter in. But due to the roundness of both colliders, he can come into force in the cave, glitching through the terrain collider.

    I think it's velocity is not excessive, I'm moving the character with
    rb.MovePosition()
    in the
    FixedUpdate()
    , and I set its rigidbody collision detection to Continuous speculative (tried all the "continuous" modes)

    In the animation below, you can see the mesh of the cave and the capsule collider around the character.

    How can I prevent this from happening? How can I say to Unity: "I want the colliders to be rock solid and not marshmallow"?

     
    Last edited: Sep 29, 2019