I have made my whole tilemap unwalkable, then i made walkable nodes only the ones that have a tile in the tilemap. My npc spawns correctly on the tilemap finds a random place to walk and shows the route he will take but then stays at the same place and doesn’t move. AIPath component should make the npc move with the command aiPath.destination = worldPosition; right? Maybe the problem is with the collider? Any ideas what I am doing wrong?
Here is a screenshot for the AstarPath component too
Also, this is where i tell my npc to move to the position.
Hmmm… I’m not seeing anything in particular that’s jumping out as an issue. I’m gonna let Aron know about this one, and see what he thinks might be up here.
Just some quick questions that come to mind- What other components do you have on your agent? And is there any other code affecting movement or position?
The prefab has Rigidbody2D, Capsule Collider 2D, Seeker, PathAI and the script that spawns the NPC finds a random tile to move to and uses this line to make him go there using the PathAI: aiPath.destination = worldTargetPosition;
When i just switched from PathAI to LerpAI it worked with exactly the same components and i just changed the aiPath.destination to aiLerp.destination. No other script to affect movement.
Hi
Everything looks good from what I can see. I don’t see why the agent would not move to the destination. Are you sure the destination is correctly set?
Make sure that you don’t call SearchPath every frame.
It’s ok it works with Lerp so it’s fine. I am pretty sure the destination is correctly set. Is it possible for the AILerp to move only in x or y axis and not diagonally?
Sure. Set Grid Graph → Neighbours to Four.
You may also want to set A* Inspector → Settings → Heuristic to Manhattan.