Search Unity

Question Objects fall through floor

Discussion in 'Physics' started by andrewblance, Dec 19, 2023.

  1. andrewblance

    andrewblance

    Joined:
    Aug 28, 2018
    Posts:
    10
    Hello all. I am going through sets of tutorials, and have encountered an issue that some of my objects (even though they have a collider and rigidbody) sometimes fall through the floor (a plane which has a mesh collider)

    Here is a pen I am making:
    upload_2023-12-19_18-34-48.png

    and my plane, which it falls through if it I drop it on:

    upload_2023-12-19_18-35-26.png

    My understanding was that since the plane has a collider, rigidbodys should not fall through it? However, the pen always done. There are some other objects in the scene, which fall through it sometimes, but not always which has confused me.

    I suspect, but can never reproduce it perfectly, that it has something to do with the mass or velocity of which the object hits the floor.

    How can I make it so my objects never pass through the floor?
     
  2. zulo3d

    zulo3d

    Joined:
    Feb 18, 2023
    Posts:
    1,000
    On your marker/pen set the collision detection mode to Continuous.
     
    andrewblance likes this.
  3. andrewblance

    andrewblance

    Joined:
    Aug 28, 2018
    Posts:
    10
    thank you very very much!

    is this to do then with the speed the marker hits the floor? By switching to cont we poll the object's position more and it doesn't pass through?

    I understand that there must be a performance implication to having all your objects set to continuous. Is there a rule of thumb around what should be discrete vs cont? Is it based on size/speed/accuracy you need?
     
  4. zulo3d

    zulo3d

    Joined:
    Feb 18, 2023
    Posts:
    1,000
    Try to imagine the object's collider stepping through the world and if a step could result in the collider not overlapping other colliders because of its velocity or scale then switch to Continuous.