Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Minimum Capsule Collider size to collide with Mesh Collider?

Discussion in 'Scripting' started by aerende, Dec 4, 2010.

  1. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    I have a Capsule Collider on a Mesh Renderer along with a Rigidbody on one Game Object. The other Game Object has a Mesh Collider on a Mesh Renderer also with a Rigidbody. As the Capsule Collider gets smaller, eventually the Capsule Collider and the Mesh Collider no longer collide.

    1) Should this non-collision occur? Or is there some parameter I can adjust to fix this?

    2) Or is there a way to determine what this minimum size for a Capsule Collider is, where collision with a Mesh Collider will no longer occur?

    3) Is the problem that the size of the Capsule Collider is approaching the size of a mesh on the Mesh Collider?
     
  2. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,327
  3. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    @Jessy -

    Minimum penetration for penalty was set to 0.01 and I set it to 0.001 and it seemed to help a little but not enough. Although now, collisions are being registered, i.e. OnCollisionEnter gets called more often, but the GameObjects don't always bounce apart when OnCollisionEnter gets called. Do you know if there is a parameter I could change to increase the bouncing apart of the GameObjects on collision?
     
    Last edited: Dec 4, 2010
  4. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,327
    No, I don't recall having this problem, but I don't use mesh colliders. Is it convex, and if so, have you checked the convex box? I don't know if that would help, but it seems reasonable. I had some problems in the past with mesh colliders; they're not represented as volumes (except maybe when "convex", although I don't really know), so if something has passed through them, there's nothing to push around. Primitive colliders are "solid", so that problem doesn't exist. It all depends on what shapes you can deal with.

    You could also try decreasing the physics timestep, but I'd try one of the former approached first.
     
  5. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    @Jessy -

    I didn't have Convex checked on the Mesh Colliders earlier, so I checked that and that seemed to help somewhat, but still some of the collisions don't cause a bouncing apart of the GameObjects.

    I also noted that when I set the Mesh Collider to Convex, I got the error

    Since the maximum polycount for convex colliders is 255, using Convex probably isn't the way to go.

    BUT decreasing the Fixed Timestep from 0.02 to 0.01 fixed the problem and now all collision cause bouncing apart of the GameObjects.

    Thanks!
     
  6. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,327
    Glad to hear it's working. But .01 is the default. Why did you change it? (Personally I set it as high as possible, so I'm not saying you did something wrong. Just interested.)

    ...Hmm. Nevermind. My new projects are starting with that too. Wonder when and why they changed that.
     
    Last edited: Dec 5, 2010
unityunity