A* Pathfinding Project

[SOLVED] Returning collisions along the path


#1

Hi all,

I was wondering if it is possible to return if a specific collision happened on a path, ideally returning the actual collision.

Basically, I have doors in my turn based game. Doors require an action to open. They do not act as blocking terrain for pathing, but my character needs to interact with the door to open it. Ideally, I’d like the path finding to ignore the door, but let me know that there was a door collision and that I need to create this action.

Is this doable?

Thanks


#2

Hi

You could use tags for this: https://arongranberg.com/astar/docs/tags.php
Mark the door using a tag and then you can go through the tags of each node in the path and check if it is the door tag. It might be easier to just use a raycast to check for a door collider as the character moves though.


#3

This is perfect! Thanks :smiley:


#4

@aron_granberg is it possible to have a tag overwrite an area? At the moment, everything that is on the Geometry layer is unwalkable. The main object here is my walls. I also have a tool that allows me to cut out some of these meshes, i.e for doors.

How can I mark this cutout area as walkable? Is that possible?


#5

FWIW: I am only trying to draw a path right now. My component currently looks like this

image

My code:

From what I can tell, the tags for the door are not overwriting. Is this expected behaviour or am I doing something wrong.

Thanks.


#6

My Door setup:

and my Seeker setup:
image

Sorry its over 2 posts, new users can only post 2 images at once :confused:


#7

SOLVED! It was some issues with colliders on my side :expressionless:

Thanks for being my rubber duck :smiley: