2
\$\begingroup\$

My ball which has a circle collider 2D component occasionally passes through my box collider2D object. Both objects have rigidbodies attached. I have set a high mass for my box collider and a small mass for my ball. Strangely enough, it doesnt pass through every time (maybe due to varying velocity). Basically i am making pong.

Ball details

Box details

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Did you try to increase the thickness of the paddles? \$\endgroup\$
    – Vaillancourt
    Commented Jan 23, 2016 at 16:17
  • \$\begingroup\$ Just tried it and its working now. I cant believe i didn't try that! Thank you! \$\endgroup\$
    – AeonSage
    Commented Jan 23, 2016 at 17:55

2 Answers 2

1
\$\begingroup\$

This is because the ball -at high velovity- will be before the box in one frame and behind the box in the next: so no collision has occured.

To fix this make sure the collision is continious or interpolated.

Set your collision mode to DynamicContinious for high velocity objects or Continious for fast objects. This does have a bit of an impact on performance if you have a lot of objects so just apply it to objects that move fast.

See: http://docs.unity3d.com/ScriptReference/CollisionDetectionMode.html

\$\endgroup\$
-1
\$\begingroup\$

It turns out all i had to do was increase the thickness of the box collider.

\$\endgroup\$
1
  • \$\begingroup\$ While this works for your situation now, there is a solution for this problem ("bullet-through-paper" as it is usually called) so you won't need to change your objects- you could have thin paddles if you like. See my answer for the details. \$\endgroup\$
    – Felsir
    Commented Jan 23, 2016 at 18:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .