In my game the player is allowed to click anywhere on the screen, this world space position vector sets the “Pathfinding.AIPath.destination”. Now I’d like to prevent the user from clicking inside of a collider, to prevent the character from walking close to the collider, never reaching its destination, thus endlessly continuing to walk on the spot, instead of stopping.
With the bool “AstarPath.GetNearest(destinationPosition, NNConstraint.None).node.Walkable;” I can test if the destination position is inside a collider or not, however I’m finding that with a 2D Composite Collider, only the outline of the collider is marked as “non-walkable”.
Is there a way of completely marking the inside of a collider as “not walkable”?
I tried increasing the “Collision Testing > Diameter”, but that also results in the “non-walkable” nodes expanding away from the collider, meaning the player can’t even get close to the collision surface anymore.
The following picture depicts the collision/walkable nodes:
And here is the outline of the Composite Collider 2D, I marked the area inside of the collider which I’d like to be “non-walkable”.
Thanks for you help,