A* Pathfinding Project

Make NPC want to travel on road by default


#1

Hello :slight_smile:

I’m wanting to make my NPC’s travel on roads when they are just traveling normally, until they happen to be attacked, then naturally they would go off the road.

Any ideas on how I could approach this? My only idea is to swap out the agent component, where they essentially follows a node-based path (all the roads in the world) , until they need to swap navigators again (aka being attacked). Is this the best idea? The biggest issue with this is that it would then naturally not use actual pathfinding, so if there’s something in the middle of the road, they wouldn’t know.

Is there a way to somehow provide a “preset path” to the agent, and the pathfinding tries to find a solution that is nearest to that?

Finally, another possibility could be to somehow make the road it’s own navmesh, aka a separate agent. How this would work is beyond me, however.


#2

if you use the pro version . i think you can try to use seeker.StartMultiTargetPath() when the NPC is on the road.

just put some waypoint on the road. and pass it into the function. :grinning: