x


rigidbody sphere falls through collider plane

Hi, first of all: I'm absolutely new to Unity (v2.6.1)... I've created a plane and a sphere in Maya (for a simple pinball game I'd like to create in Unity) and exported both as one FBX file (including normals).

In Unity I attached a rigidbody and a sphere collider to the sphere ("use gravity" set to true), and a mesh collider to the plane ("IsTrigger" set to false for both objects). The sphere is placed above the surface. When I hit "play" the ball falls through the plane to infinity. If I enlarge the sphere collider quite a lot (about three times the size of the sphere geometry), it still falls through the plane but keeps hanging under the plane. If I scale the sphere collider even more the sphere falls down and its collider rolls over the surface of the plane (the sphere is of course "floating" in the air - because I expect only the colliders are used for physics calculations).

Any idea what's my mistake?

more ▼

asked Jan 14 '10 at 04:36 PM

drhenry gravatar image

drhenry
395 11 11 23

Can you post the meshcollider? It's hard to answer just form your description.

Jan 14 '10 at 05:35 PM Max Kaufmann
(comments are locked)
10|3000 characters needed characters left

7 answers: sort voted first

Fast movement and/or thin colliders are a real issue when using physics.

You're right, movement is taht fast and there is no interpolate between frames, so an object can pass through another thin object (because their positions never actually collided each other)

You can try to bypass with a raycast collider searching for possible colliders like in the script DontGoThroughThings here:

http://www.unifycommunity.com/wiki/index.php?title=DontGoThroughThings

That script can help a lot with that problem, but is no 100% fail-safe, so try to make colliders as thick as you can.

more ▼

answered Jan 16 '10 at 07:26 PM

Dwair gravatar image

Dwair
358 1 2 4

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

Make sure your sphere is somewhere around (1,1,1) in scale. Change the scale factor in the mesh importer if necessary. Having a mesh collider for a flat plane is perfectly fine; this is what the default Unity plane has. But the physics engine does not like small objects.

For a pinball game, I would increase the physics timestep quite a bit so physics runs at least 100fps. This does of course increase the CPU power needed, but a pinball game doesn't have many moving objects so that shouldn't be an issue.

more ▼

answered Jan 16 '10 at 08:44 PM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

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

I think MeshColliders don't work for totally flat planes. Use a plane collider instead.

more ▼

answered Jan 14 '10 at 08:34 PM

Lucas Meijer 1 gravatar image

Lucas Meijer 1 ♦♦
8k 19 43 85

MeshColliders work fine for planes - and there is no such thing as a PlaneCollider in Unity for that matter :)

Jan 18 '10 at 01:48 PM jonas echterhoff ♦♦
(comments are locked)
10|3000 characters needed characters left

I hope you meant by "posting the meshcollider" posting a screenshot of the Inspector view. There you go:

http://www.freeimagehosting.net/uploads/df1ca0f4dc.jpg PlaneInspector

Concerning the plane collider: did you mean the box collider? I've tried to use the box collider instead of the mesh collider but the sphere still falls through the plane (even if I enlarge the height of the box collider, which was originally set to 0).

more ▼

answered Jan 15 '10 at 07:56 AM

drhenry gravatar image

drhenry
395 11 11 23

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

Another thing I've discovered: if I place a Unity cube beneath my plane, the sphere falls through this box, if it is scaled very flat, and doesn't fall through it, if the cube is thicker (having a box collider attached to the cube).

more ▼

answered Jan 15 '10 at 08:10 AM

drhenry gravatar image

drhenry
395 11 11 23

(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:

x1792
x1700

asked: Jan 14 '10 at 04:36 PM

Seen: 12444 times

Last Updated: Jan 28 at 09:49 AM