Move To And Stop At the Closed Door

Hi Aron,

I’d like to ask the question:
let’s say my gent is inside a closed door room, unreachable to the outside area. if i set any outside area as the target position, i want the agnet to move to and stop at the door, rather than move to wall places which may be closer to the the target end position.
what is the best way to achieve this?
thank you very much!

Han Xu


One way is to allow the agent to pathfind to the target without any constraints, but then you use a raycast in front of the agent to check if it is about to hit a door. If it is about to hit a door you set ai.isStopped = true. You can use ai.steeringTarget for the raycast.

thank you very much, i’ll use this to solve my problem.
Instead of this solution, is it suitable to make it as a function in pathfinding system to be able to move the agent to some high priority areas (opposite of Penalty)?

That would not solve your problem, I’m afraid. It cannot use that to determine where to stop.