x


Collider size question

  1. Create a new project
  2. Create Other GameObject -> "Cube"
  3. Create Other GameObject -> "Plane"
  4. Move Plane to -1 in Y direction
  5. Replace the box collider on the Cube with a Mesh collider
  6. Change both colliders to convex
  7. The Cube collider matches the shape of the cube
  8. The Plane collider is orders of magnitude thicker then the plane.

Can anyone tell me why?

The collider size also does not seem to be affected by the Y scale.

EDIT Note: I haven't accepted one of the answers below as I was referring to two meshes both with convex set. It seems it's not possible to over ride the size of a mesh collider on built in objects.

more ▼

asked Nov 21 '09 at 07:35 AM

ibyte gravatar image

ibyte
544 12 18 27

(comments are locked)
10|3000 characters needed characters left

4 answers: sort voted first

because a collider should have a value greater than zero in all directions. a plane is a plane of vertices with normals and even is not visible from the opposite side but colliders are shapes and their calculation has nothing to do with the mesh. as you understand the plane has no thickness because it's just a series of vertices with their normal in same direction. there is not a real world shape for them in 3D and you can not find anything with only one side available in real world so their collider shape should be a verry thin box like shape.

more ▼

answered Nov 21 '09 at 08:25 AM

Ashkan_gc gravatar image

Ashkan_gc
9.1k 33 56 117

Hi Thanks for the explanation and I agree a very "thin" box like shape would be fine but the collider added is very thick. If you do the test you will see what I mean. IF it could be scaled in the "y" direction that wold help a lot.

Nov 21 '09 at 07:41 PM ibyte
(comments are locked)
10|3000 characters needed characters left

When you add a collider component to an object with a mesh, the collider auto-sizes to fit the mesh, but that's just a convenience. You can adjust the size of the collider manually in the inspector, in the collider's "size" property - see the Box Collider section of the Unity manual (in the Reference section).

more ▼

answered Nov 21 '09 at 10:21 PM

technicat gravatar image

technicat
1.5k 10 11 34

Mesh collider's don't have this property.

Nov 22 '09 at 02:24 PM ibyte
(comments are locked)
10|3000 characters needed characters left

Replace the Mesh Collider on the Plane with a Box Collider. It will fit your plane, and you can adjust the Y thickness (I tested 0.001, which still stopped a falling rigidbody).

more ▼

answered Dec 03 '09 at 02:22 PM

Novodantis 1 gravatar image

Novodantis 1
1.7k 14 22 40

But tunneling still occur easily if the object falling is thin or is moving fast. (Worst case being thin and fast).

Dec 04 '09 at 09:23 AM Statement ♦♦

That is a general issue with using such a narrow object for collision. If it was essential, you could always decrease the time interval of checking the physics engine (Edit > Project Settings > Time > Fixed Timestep).

If it was a platform, you could offset the collider downward so that the top matches the surface, but it has seveal units of thickness below.

Dec 04 '09 at 10:29 AM Novodantis 1
(comments are locked)
10|3000 characters needed characters left

A possible "work around" to my question is to create and resize a cube to match the size of the plane. Of course this add's more vertices/faces but at least the collider will match the shape of the cube even if I make it extremely thin.

more ▼

answered Nov 21 '09 at 09:26 PM

ibyte gravatar image

ibyte
544 12 18 27

you can easily change properties of a collider like it's size and center and ... you can use a plane and use any type of collider you want with customized properties and size. you can even use a sphere collider and there is no limitation. the created collider is just for making the process easy.

Nov 22 '09 at 02:33 AM Ashkan_gc

Mesh collider's don't have size and center properties.

I noted this from the Unity help "The Mesh Collider builds its collision representation from the Mesh attached to the GameObject, and reads the properties of the attached Transform to set its position and scale correctly."

So it would seem since it can't be zero the next increment of one full Unity unit which for my purposes is way too big.

Nov 22 '09 at 02:25 PM ibyte
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2090
x1879
x1703

asked: Nov 21 '09 at 07:35 AM

Seen: 5535 times

Last Updated: Dec 10 '09 at 04:42 AM