- Home /
Best way to check collisions in a 2D Game?
I've read this: Guidelines for using rigidbody, collider, CharacterControllerScript, etc
But I still don't know which is the best way to check collision in a 2d game.
I'm using a CharacterController component for my player (which also has ex2DSpriteAnimations). The run and jump works fine, the problem is that I want my player to attack and check if he hit something (with OnTriggerEnter maybe?). My current approach is add a BoxCollider as a children and activate it when the "punch" frame is playing, but it doesn't seem a good way to do it.
Any suggestions? Thanks!!
A game in 2D is exactly the same as in 3D. It is like you, you live in a 3D world but imagine you would be constrained (is that a word?) in a straight corridor at all time (and you have a camera next to you). So any collision detection goes the same, only should you make sure everyone is on the exact same z-position (depth).