Wander Task picks Destinations that are off the Grid.

Hello,
I'm having trouble getting my AI to Wander as it keeps selecting destinations that are off the Grid Graph and that it can't reach, resulting the AI getting stuck trying to reach an unreachable destination. I am attaching a screenshot of my Behavior Tree.
Please any help on the matter would be greatly appreciated, I'm not sure what I could be doing wrong?
 

Attachments

  • Astar_BT.jpg
    Astar_BT.jpg
    728.9 KB · Views: 0
Here is the rest of my setup, including AI Inspector setup as well as my Astar Grid Graph Inspector
 

Attachments

  • AI_Inspector_1.jpg
    AI_Inspector_1.jpg
    208.3 KB · Views: 0
  • AI_Inspector_2.jpg
    AI_Inspector_2.jpg
    187.6 KB · Views: 0
  • Astar_Inspector.jpg
    Astar_Inspector.jpg
    195.6 KB · Views: 0
Then here is my RVO Simulator's Inspector, along with what my Grid Graph looks like and an example of how the Wander Task picks a spot that is Off Grid that the AI can't reach, causing it to get stuck
 

Attachments

  • Astar_RVOsim_Inspector.jpg
    Astar_RVOsim_Inspector.jpg
    121.2 KB · Views: 1
  • Astar_GridGraph.jpg
    Astar_GridGraph.jpg
    624 KB · Views: 1
  • AI_Stuck.jpg
    AI_Stuck.jpg
    378 KB · Views: 1
I also have Obstacles and Ground Layers set up and baked the Grid Graph accordingly as well as set all the Objects to their correct layers and set up the AI accordingly as well. So, I'm not sure what I could be missing?
 

Justin

Administrator
Staff member
The Wander task calls SamplePosition before it sets the destination so it should always be valid. You can debug this by setting a breakpoint within IAstarAIMovement.SamplePosition and ensuring AstarPath.active.GetNearest(position).node.position returns the correct position. If it's not returning a valid position then it's something on the A* side of things and I would post the question on their forum.
 
The weird thing is even if I create a brand new blank scene, with a basic plane and 4 Cube Obstacle setup and using the AI Destination Setter not even a Behaviour Tree, the AI would still move through walls instead of following the path it drew around the wall.
Literally, the only places where A* is working properly is in their Example Scenes.
 
The closest I can get is with a Blank New Project with literally only A Star imported. But even then, in my own scene, while the AI goes around the walls and not through them, it can still get stuck at corners moving back and forth, depending on the position of the AI, the position of the Target and the path curving around the wall, which doesn't happen in their Example Scenes.
 
Top