Help with setting destination on custom character controller

Hey guys,

I just got A* Pathfinding and it looks amazing, but I am having a little difficulty setting it up with a custom character controller. My AI is procedurally animated using physics, and the direction in which the AI should walk happens through the following code: inputDirection = (this.chestBody.transform.position - player.transform.position).normalized * -1;

What I throught I could do was replace player.transform.position with ai.destination from the AIDestinationSetter script but when I add IAStarAI ai to my script, even when adding using Pathfinding I get the error error CS0246: The type or namespace name AIStarAI could not be found. Are you missing an assembly reference?.

Would anyone happen to know what and how I could replace the player.transform.position part of my code to have my AI walk on the path set by the A* script?

Any suggestions or feedback would be super appreciated as I am completely stumped on what I should be referencing to get my AI to walk down the path drawn by the AIPath script.

Hi

You have spelled that wrong, it’s IAstarAI, not AIStarAI.

It sounds like you want to write a custom movement script, then this tutorial is for you: https://arongranberg.com/astar/docs/custom_movement_script.html

You can alternatively override just the movement part of an existing movement script (e.g. AIPath). See this page: https://arongranberg.com/astar/docs/iastarai.html#MovementUpdate
Note that IAstarAI is an interface that all built-in movement scripts implement.

Hi Aron,

I just wanted to thank you for replying so quickly and providing the resources to fix the issue. It was a long and painful 12 hours but I managed to fix the code and to make it all work.

Thanks again for your help and your amazing pathfinding package.

1 Like