Hi all, Unity noob here,
I am making a 2D top-down game the player moves with grid-based movement (i.e. Pokemon). Now I know that collisions with grid-based movement are tricky, and since I can’t wrap my head around how to do this with a 2D array, I’ve decided I want to do it with raycasting. Here’s my scene:
I would like to make it so a ray is being “shot out” from my player in all four directions, and if the ray’s distance (between player and wall) is less than 1 tile, then the player will be prevented from moving in that direction. I’ve had a really hard time finding Raycast2D tutorials that I can wrap my head around. How do I best set up these 4 rays and how do I then check to see if they’re colliding with something?