Hello there,
I am using a point graph and I have set up a simple patrol enemy with an AI Lerp and Patrol script.
The player is also controlled by an AI Lerp and the Target Mover Script.
Unfortunatly the enemy leaves his path to follow the target aswell, instead of staying on his path. Is there a way to disable that?
Thanks
Hi there, I’m having a bit of trouble understanding what issue you’re having. You’re trying to have an enemy agent stay rigidly on a path, but they deviate to follow the target? Does this mean they just ignore the path completely? Or only under certain situations, such as when something is too close? Media such as images and videos go a long way here! Also, a screenshot of your AI Lerp settings may help
Thanks for your reply
I have a 2D game with a point graph.
I have an Enemy (Gator) with an AI Lerp component and a A Star Patrol Script.
I have a Player with an AI Lerp component:
And finally I have a PlayerCam with a Target Mover Script.
A click on the map will move the target and the player will follow to the new destination.
But the Enemy Gator will move to the new target destination as well. I don’t want that. I want the Enemy to continue his patrol.
Thanks for the clarification! I did some looking up and it looks like the TargetMover script is a script made for the sample scenes. Digging into the code (loosely) it looks like Aron designed it so that it simply gives all AIs in the scene a new destination, hence your gator getting the destination as well.
Here’s the comment from the top of the script:
/// Moves the target in example scenes.
/// This is a simple script which has the sole purpose
/// of moving the target point of agents in the example
/// scenes for the A* Pathfinding Project.
///
/// It is not meant to be pretty, but it does the job.
I’d recommend creating your own ‘click to pathfind’ script in this situation (or I suppose modifying the example one, but I think the amount of work you’d use modifying it would be better put into a new one). If you need assistance with getting that going, we’d be glad to help