Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Resize plane object mesh collider?

Discussion in 'Editor & General Support' started by ibyte, Oct 14, 2009.

  1. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    I am simulating dropping a bunch of balls onto a plane. In order to get the balls to bounce according to their shape I have made them ridgedbodies and applied mesh collider components with convex set. When they hit a plane with a box collider or mesh collider they bounce (having applied a bouncy material).

    What i am experiencing now is with a box collider set on the plane some objects fall through the plane and some do not. If i change it to a mesh collider I get the same thing. If I set convex on the mesh collider then no balls drop through.

    A side effect of this is that the convex mesh collder is a lot thicker then the non convex collider (box or mesh).

    How do i scale down the convex mesh collider?

    iByte
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    A MeshCollider will be the same shape as the mesh it is attached to. MeshColliders don't collide correctly with each other unless they are marked as convex, but the shapes actually have to be convex for this to work properly. Also, there is a limit of 255 triangles on convex mesh geometry. Unless it is very important for the balls to use MeshColliders, it would be much better to use SphereColliders on them.
     
  3. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    When convex is set on a mesh collider for a plane gameobject the the collider is quite a bit larger in all dimensions.

    This is not the case for say a cube gameobejct

    Any insight as to why this is like this?

    iByte
     
  4. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Some of the objects are not round so i can't use the sphere collider and they are all under the 255 tri's.

    When using all convex colliders I get the behaviour i want it's just that the objects do not lay flat on the plane when they come to rest as they are held up by the collider. If i uncheck convex on the plane then the objects drop to touch the plane but then some of them fall through the plane.

    iByte
     
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Are the objects marked as convex definitely convex? I suspect that if they aren't then the physics engine might attempt to round them off, so the contacts will not be correct.
     
  6. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Well the objects in question are a football, hockey puck, hockey helmet and football helmet.

    Since they are low poly models they do have some flat sides - especially the puck.
    For example when i turn convex off after dropping the objects all the pucks fall through as the are usually lying on the flat side of the puck. Again thats when i turn convex off on the plane.

    Have you checked out the size difference on a cube vs plane convex mesh collider?

    iByte
     
  7. BG_Grill

    BG_Grill

    Joined:
    Apr 18, 2020
    Posts:
    3
    If anyone see's this tread, just scale your plane down on the Y-Axis, really simple.
     
    Morthrax and hyorange like this.
  8. xseryoga

    xseryoga

    Joined:
    Jun 25, 2023
    Posts:
    1
    Thank you Sir! Appreciate to provide an answer for a old post. Worked for me!