- Home /
Unity 2D game: all colliders not working
Hi all,
Unity version: 2020.3.4f1 Personal
I set up Rigidbody 2D and Box Collider 2D for the player, however, it can still walk through the "wall" that has both components.
Actually the colliders of all objects in the game aren't working. May I ask what's wrong?
Screenshots: The Player can go through the "wall"; both the player and the wall are on "Sorting layer 04", "order in layer: 3"; Position Z:0
Inspector info of the player:
I supposed it isn't necessary to add any code or script to activate the colliders?
Thanks and have a great weekend!
Answer by logicandchaos · Apr 27, 2021 at 01:59 PM
It's because on your collider isTrigger is checked. Uncheck it to have physics collisions.
Answer by eduardoks1998 · Apr 27, 2021 at 07:31 PM
Uncheck isTrigger and change collision detection to Continuous
Answer by Osinskie · Apr 28, 2021 at 05:46 PM
Static objects should just have colliders. Dynamic objects should have rigid bodies.
In your final step, if things launched around, it sounds like maybe an object's collider was inside of another. In which case the physics engine tries to get then out and ends up launching them most of the time.