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

Object keeps falling through plane

Discussion in 'Physics' started by joostvanpoppel, May 9, 2018.

  1. joostvanpoppel

    joostvanpoppel

    Joined:
    Nov 24, 2017
    Posts:
    41
    Hi,

    I'm pretty new to Unity and learning the physics. I created a simple plane and positioned a sphere and a prefab soldier above it. I attached a rigid body (use gravity off, is kinematic on) and a box collider. To the sphere I added a rigid body (use gravity on, is kinematic off), it had/has a sphere collider on creation. To my prefab soldier I added a rigidbody (use gravity on, is kinematic off) and added a Mesh Collider.

    Upon running the game, the sphere stays on top of the plane but the soldier falls through the plane.
    Can you guys tell me what is happening? Has it something to do with the soldier being build from several parts? Any advise on solving this? (The soldier should stand on the plane)

    thx in advance,
    Joost
     
    Anikate25 likes this.
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,193
    Your MeshCollider doesn't have a mesh, so I don't think it has any actual collision.

    Typically with models like that, you'd add a Capsule Collider instead of a Mesh Collider. Mesh Colliders are expensive, and usually you just want the character to behave like a box/capsule anyway. So I'd recommend removing that Mesh Collider, and replacing it with a Capsule Collider.
     
    o12d and Tonymotion like this.
  3. joostvanpoppel

    joostvanpoppel

    Joined:
    Nov 24, 2017
    Posts:
    41
    The Capsule Collider works on the plane! Thanks for the advice...
    Also had the problem with a prefab terrian, also working now!
     
  4. Tonymotion

    Tonymotion

    Joined:
    Dec 5, 2018
    Posts:
    12
    Thank you, Dgoyette! I had turned on kinematic on my moving object to keep it from falling through a surface, but they I was no longer able to AddForce to its rigid body. With the Capsule Collider, I can!

    I can't figure out, though, why the Box Collider on the object didn't prevent it from falling through the surface, but the Capsule Collider did. And why did selecting Kinematic on the object's RigidBody stop AddForce from working? Does anyone know?
     
    Last edited: Jul 24, 2020
  5. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,193
    That doesn't make any sense. A box collider should behave essentially the same as a capsule colliders for the purposes of falling through some other collider. For that matter, AddForce won't move a rigidbody if it's Kinematic, no matter what its collider is. I suspect you have something else going on.
     
    Rickmc3280 and SparrowGS like this.
  6. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    187
    If anyone finds this in 2021 and were looking because you have the same issue as the box collider on the plane with another collider... Check the "Size" feature in the "Box Collider" if you scaled the plane on both objects. I scaled my plane and the sizing dimensions were off on the plane.
     
    CarlosCecil likes this.
  7. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    Have you got convex selected on your meshcollider.
     
  8. CarlosCecil

    CarlosCecil

    Joined:
    Jul 27, 2021
    Posts:
    1
    This worked for me! Fingers crossed this helps some other people out
     
  9. potorium

    potorium

    Joined:
    Dec 29, 2019
    Posts:
    2
    Found my issue. The plane had a mass of 1, isKinematic false with freeze position x,y,x. So when my skeleton dropped onto the plane both sink with gravity as skelly adding force to the plane. plane didnt need a rigidbody but iskinematic true stops the plane having force added from objects falling onto it. I was adding mass 100 to skellies so projectile hits push them but not halfway across the world! in turn made plane suffer from collisions moving it
     
  10. BenHenriques

    BenHenriques

    Joined:
    Apr 6, 2021
    Posts:
    44
    Hello, currently having a similar issue. I have a car with a rigidbody and box collider as well as 4 wheel colliders which is falling through my plane. My plane has a rigid body (is kinematic true) and box collider.
     
  11. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,315
    Please don't post duplicates. You did the correct thing by creating your own post here.
     
  12. luke5647

    luke5647

    Joined:
    Feb 23, 2022
    Posts:
    12

    This worked for me in terms of my player staying on the plane so thank you for that, but now all my movement doesn't work and whenever I add a rigidbody to my player, my player stays on the plane but the camera falls through. Do you know why this could be?
     
  13. adelhamed2006

    adelhamed2006

    Joined:
    Jan 9, 2023
    Posts:
    1
    This issue has been asked and repeated a lot of times and I personally had ALOT of trouble with it.

    There are probably many solutions, but I tried unchecking isTrigger from my colliders and it did work, though I needed the colliders to be triggers, so I instead added two colliders to each object, both are exactly the same except that one is a trigger and the other isn't, and it seems to work just fine,

    if anyone has any better solutions then please post it below.
     
    alle0nardo likes this.
  14. alle0nardo

    alle0nardo

    Joined:
    Nov 18, 2023
    Posts:
    1
    Gotta say, this is the solution that did it for me. I don't know why it works, but it does. :D