What is the best way to do a 2D Ground Check?
Hello, I've been attempting to make my first 2D platformer game. After watching a handful of tutorials I realize there are several different ways of checking if your Player is "Grounded". First I tried the "OnCollisionEnter way" & "OnCollisionStay way". This works fine if a tag my ground surfaces "Ground" ect. but, I'm using Unity's new Tilemapping system. So, if I want to jump on a "Single Unit Tile" tagged "Ground", I can basically "Wall-Jump" off the sides of them. (because grounded bool is true if colliding from the side of the Player's collider).
My next approach was to use "Physics2D.OverlapCircle" or "Physics2D.OverlapBox". The results of both were very similar. The issue I found is that if I make the overlap collider slightly wider (x) than the Player's collider, then I still get the undesired "Wall-Jump" effect and if I make it slightly thinner (x) than the Player's collider, then my grounded bool goes to false when the Player is just barely at the edge of a platform. (hanging by his toes).
Lastly, I tried the "Raycast approach" which basically gave me the same results in a different way. (also more expensive). This leaves me wondering, what is the best way to implement the Player's "Ground Check"?
Any help/ insight is greatly appreciated!
Thanks in advance.
Your answer
Follow this Question
Related Questions
Ground Script explanation 1 Answer
Bounds and extents of a tilemap collider across differing y axes, Tilemap collider bounds 0 Answers
Collision Detection on Rb with Interpolation and Rb with Extrapolation does not work the same way. 0 Answers
RayCast StandartProjectAssets Ethan prefab problem. 2 Answers
Raycast doesn't work properly 1 Answer