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 Mesh Collider Not Working

Discussion in 'World Building' started by ercanacar, Jul 21, 2020.

  1. ercanacar

    ercanacar

    Joined:
    Jan 30, 2020
    Posts:
    8
    I have a cylinder object and delete the top face. An object can go through it, and the mesh collider doesn't work. What can I do?

    Probuilder 4.3.1
    Unity 2019.4.4f1
     

    Attached Files:

    Last edited: Jul 21, 2020
  2. ercanacar

    ercanacar

    Joined:
    Jan 30, 2020
    Posts:
    8
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Your mesh is not marked Convex. And you didn't include the Static checkbox in your screenshot, but I bet it's off.

    That all matters, because things can't collide with non-static, non-convex mesh colliders. Calculating such collisions is very expensive and so Unity (or PhysX) just doesn't do it.

    You should certainly check Convex on this mesh, because it is in fact a convex mesh; and if it doesn't need to move, you should check Static as well.

    Also, you have it marked as Kinematic. That removes it from most of the physics calculations. Uncheck that unless you know what you're doing and have a good reason to use kinematic mode.
     
    antoinebr_unity and kaarrrllll like this.
  4. ercanacar

    ercanacar

    Joined:
    Jan 30, 2020
    Posts:
    8
    Thank you for replying, I tried marked convex. At that time, The balls are on the object. I want them to get inside.

    @JoeStrout
     

    Attached Files:

    Last edited: Jul 21, 2020
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Hmm, that confuses me because you said in your first post that you deleted the bottom of the cylinder. So other objects resting on the top of the cylinder would be quite right.

    If you really mean to delete the top face and make something like a bucket, then it's not a convex collider. You won't be able to use this unless you make it Static.
     
  6. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    Here is a screen-grab of a working setup. The top faces of the cylinder have been deleted, and the face normals flipped. The left Inspector shows the settings for the sphere, while the right Inspector is the settings for the cylinder. As @JoeStrout pointed out, it is important to note that the Cylinder is flagged "Static."

    upload_2020-7-21_14-56-53.png
     
  7. ercanacar

    ercanacar

    Joined:
    Jan 30, 2020
    Posts:
    8
    Typing mistake, top face deleted. And you are right, I want that like a bucket.

    I did static but not working again.
     

    Attached Files:

    Last edited: Jul 21, 2020
  8. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    In your screenshot it says the shape is a Pipe, which does not have a bottom. Also, the "bucket" object does not need a rigidbody, only the spheres do.
     
    Emanx140 likes this.
  9. ercanacar

    ercanacar

    Joined:
    Jan 30, 2020
    Posts:
    8
    I gave the name that Pipe. It's actually Cylinder.
     
  10. ercanacar

    ercanacar

    Joined:
    Jan 30, 2020
    Posts:
    8
    Any help?
     
  11. Emanx140

    Emanx140

    Joined:
    Jan 13, 2017
    Posts:
    9
    Marking as "Static" and removing Rigidbody helps. Thank you!
     
    JoeStrout likes this.
  12. ercanacar

    ercanacar

    Joined:
    Jan 30, 2020
    Posts:
    8