Collision fails

I’m trying to simulate a cricket game. As of now just working on the bowling. Both the ball and the stumps are rigid body colliders, where ball is sphere and stump is box mesh collider respectively. When I bowl a yorker or full toss, the ball passes through the stumps. The collision works fine with other ball types. … If you can guide me please do.

Hehe…you might need to translate that for those of us not familiar with the game :wink:

Can you explain the problem in more general terms?

lol… sry dude…
when I pitch the ball near the stumps it passes through it. When I pitch it far from the stumps the collision is fine.

|||…| => YORKER
|||…
…| => ORDINARY

_ => where i pitch the ball
| => stumps

(sry tried uploading picture, but wasn’t able to)

Well, I’m still not quite sure what you mean, but a common cause of missed collisions is ‘tunneling’. Not sure if that’s what’s going on here, but you might search the forums for ‘tunneling’ and see if you find anything that seems useful.

I would guess that the difference with a yorker or full toss is that the ball would be moving fast at the point where it hits the stumps. (If it bounces, it probably slows down and/or approaches from a steeper angle to the plane of the stumps.) Effectively, a fast moving object can sometimes move from one side of a collider to the other in a single physics update and therefore fail to register a collision. There are some new options in Unity 3.0 that help cope with this situation. With Unity 2.x there are a few techniques you can use to cope with the problem. Try reducing the Min Penetration for Penalty value in the physics settings (menu: Edit > Player Settings > Physics). Also, reducing the value of Time.fixedDeltaTime will increase the frequency of the physics updates. If you are using a mesh collider the same shape as the stumps, you might find you get better results by replacing it with a box collider that surrounds the whole object. Finally, you can try the DontGoThroughThings script from the Unify wiki, which anticipates collisions using a raycast.