I am writing a game with many entities in which I am trying to squeeze as much performance out of as possible. I have also noticed that sometimes the paths created are not straight lines, which for most scenarios is fine for me but not for cases when the AI is close to the player.
I am already doing linecasts for the AI to determine sight of the player. In this instance, I would like to pass the seeker/AstarPath/AIPath the line as the path without doing any other calculation. Is this possible?
This approach will not work because it would be very awkward to deal with corners. I am instead going to create a StraightLinePath will will be requested in this condition, which will use spatial awareness additionally to optimize the process, and then optimistically create a path directly, only doing any modifications when unwalkable nodes are found.
I have this same issue, and I tried using SetPath. SetPath rejected my pre-calculated path because the pipeline state of the path was ReturnQueue instead of Returned.
I was following the instructions of the docs, and constructing the path as follows:
Call ABPath Construct
Pass the resulting path to AstarPath.StartPath
Wait for the callback to fire, then pass the path to AILerp.SetPath
Is there something I’m missing? I looked into the pathqueue classes, but it wasn’t obvious how to pull the specific path I’d like out of the queue, or whether that would even change its pipeline state properly.
I altered the code of SetPath to accept both Returned and ReturnQueue pipeline states as a workaround, but it feels hacky.