Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Weird collision with some objects passing through each other

Discussion in 'Physics' started by Henry90, Jan 20, 2015.

  1. Henry90


    Nov 30, 2012
    Hello everybody, I am a newbie in this field and for the first time I am experiencing the following kind of problem. I just have a "simple" environment built by myself. Each object of this environment has a mesh collider. My player is a simple capsule for the moment and I make it move using the call rigidbody.MovePosition(). Unfortunately it happens something weird which you can see in the video right below.

    So the questions are:
    1) how can I solve the fact that my player can pass through objects even if they have a mesh collider?
    2) after my player has passed through those objects he keeps moving alone, like pushed by a non-existing "force" or anyway with a linear movement. What is it caused by? Thanks in advance!
  2. andeeeee


    Jul 19, 2005
    If I understand what is happening in the video, it looks like you can walk through the wall from inside to outside but then it blocks you from going back in again. A mesh collider only collides when the surface is approached from the "outside", but in cases like this, it is not obvious what the outside region is and so Unity just has to guess. If the walls are just fairly simple flat surfaces then you might consider implementing them just by placing a few BoxColliders around the scene. If you do need a MeshCollider then try flipping the mesh's normals in the 3D modelling app or use doubled up walls (ie, the walls have a definitely thickness and so the "inside" of the mesh is just the narrow cavity between the two wall surfaces).
    Henry90 likes this.