2D collider / Distance from wall

Hello. I am currently creating a top-down 2d adventure. I have got the basics set up fine, but come across a problem: see the picture below.

Based on the grid position, some nodes lie a good distance from the wall’s collider, but others end up squished extremely close. This means that my NPCs will sometimes end up walking ridiculously close to a wall.

I’d like to resolve this by ensuring that a node is, say, 8 units away from a collider before marking it as walkable. This would ensure a smooth, consistent border all the way around the collider. Is this possible?

Hope all that made sense :smile:
Tom

Hi

Try increasing the ‘diameter’ setting in the grid graph settings (in the collision testing group).
Make sure that the collision mode is not set to ‘Ray’.

You can also use erosion, but I would suggest starting with the diameter setting.

Yep, that did it! For the record, I think I was getting confused, assuming I had to use the ray collision mode with 2d colliders.

Thanks for your help!

1 Like

I had the exact same problem and I was also in the false belief that 2d had to use raycasting, I think that is what the “getting started guide” stated.

now it works much better, thx!

Hi

Is there some particular wording in the get started guide that makes you think that? If you could point me to it I could change the text to make sure others will not be confused.