Raycast still hits even im to the side of the tile

50 views Asked by At

I'd like to know why my raycast still detects a collision even when im one unit to the side of a tile, and how I can avoid this. It only happens on the right side, as it appears the origin of the ray is the top left, could i somehow make it start from the center of the sprite?

My issue is this registers a hit, which is ok:

enter image description here

But this also registers a hit, as highlighted by the Debug.Drawline (Red):

enter image description here

1

There are 1 answers

0
Alexander Smith-Richard On

Found the issue, had to set all sprite origins to center, not top-left!