0
\$\begingroup\$

I'm using unity circle collider 2d and rigid body 2d but when it hits the box it doesn't stop there but instead just pass through and fall. Can someone help?

Circle Collider and rigid body 2d setting

Circle collider and rigid body

Box Collider Settings

Box Collider

Game output

Output

As you can see in game output my circle instead of stopping at collision it is getting passed by box. I want the circle to fall in square rather than free fall.

\$\endgroup\$
  • 1
    \$\begingroup\$ Thank you for including all the relevant screenshots. This makes it very fast to see what's going wrong here! :) \$\endgroup\$ – DMGregory Mar 21 '20 at 14:02
1
\$\begingroup\$

Your box collider has "Is Trigger" checked.

This box means "Please do not apply physics restitution when you detect collisions with this box. Treat it as a ghost that object can pass through unaffected"

Triggers are used to detect overlaps/collisions without automatically modifying the object's movement. We use them to create things like activation zones, or intangible things like energy weapons that should deal damage on impact without imparting momentum.

If you want the box to behave as a solid obstacle, uncheck the "Is Trigger" box.

Also, be sure any motion of the objects is being applied via their Rigidbody2D. If you move an object with its Transform, that bypasses physics and can lead to tunneling through solid colliders.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.