x


Why is OnCollisionEnter not always called?

I have a missile object with a capsule collider. When I shoot the missile off, sometimes (about 50%) it will bounce off the mesh it collides with, instead of exploding. In my OnCollisionEnter method (on the Missile) I can see that the OnCollisionEnter method is not called - but surely if it bounces off the collision must be detected?

I had a similar issue with a prefab with more than one collider (on parent and child), where how the object hits another collider depends on which gets activated (only one had a scripted effect). But in this case I have only one collider, so this cannot be the issue.

Does any one have any idea what is going on, or how I could track down the cause?

*Edit * More info: I have continuous dynamics switched on on the missiles. The missiles are very small compared to the meshes they are hitting - could this be an issue?

Thanks,

ht

more ▼

asked Sep 08 '10 at 01:21 PM

Herman Tulleken gravatar image

Herman Tulleken
1.8k 27 38 57

Try using triggers instead and also make sure to use a non-kinematic rigid body

Sep 08 '10 at 10:31 PM spinaljack

I tried it, but now sometimes (~50%) they just go right through the meshes... Is there anything else I can try?

Sep 15 '10 at 10:34 AM Herman Tulleken

sounds like you're moving too fast, increase the fixed time frequency or use raycast to detect collision or wait for unity 3 and use continuous collision detection

Sep 15 '10 at 05:02 PM spinaljack
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x3677
x2523
x317

asked: Sep 08 '10 at 01:21 PM

Seen: 3361 times

Last Updated: Sep 15 '10 at 10:35 AM