- Home /
collider2D not work
HI, i have a problem with my wall object. i have add collider2d to it, and the player too. but my player still can pass it.
anyone have face problem similar like my problem? please answer. thanks
Answer by nomischen · Oct 29, 2016 at 04:33 PM
one of the Gameobjects needs to have a rigidbody component
Answer by tanoshimi · Oct 29, 2016 at 04:09 PM
A single collider does nothing. Your player also needs a collider2d and a rigidbody2d. You should probably watch some of the beginner physics tutorials: https://unity3d.com/learn/tutorials/topics/2d-game-creation/2d-physics-overview?playlist=17120
Answer by sid4 · Oct 29, 2016 at 04:14 PM
make sure your player has - collider2d - - rigidbody2d - make sure "is trigger" is not checked - make sure they are all on same layer
if you have these all it will work.
if you want to use as a trigger you can also apply more than 1 collider and set 1 as the trigger
Answer by knightOfSecrets · Aug 19, 2019 at 03:16 PM
make sure that both the player and the boundary have colliders of the same type (2d or 3d) but they neeeed to be of the same type
also make sure that is trigger is not selected in any of the objects(the wall and the player)