A* integration wander

Fixed this for myself, but it's a very specific case for my game. For anyone wondering: I edited SamplePosition in IAstarAIMovement.cs. I added a check for the proposed position to see if it's inside any given graph my AI is currently on.
9cdab03d9b25668eaae6ba43c8989f16.png

https://gyazo.com/9cdab03d9b25668eaae6ba43c8989f16

Kinda ugly, but it works so I'm leaving it as is.

Edit: Also if you're only using 1 graph in your scene, this is much, much easier. Just do:

var direction = transform.InverseTransformDirection(AstarPath.active.GetNearest(position).position - position);
direction.y = 0;
bool isInside = Astar.active.data.<YourGraphType>.PointOnNavMesh(position, NMContraint.None) != null;
if (!isInside)
return false;
return direction.sqrMagnitude < arriveDistance.Value;

In my case I have multiple graphs so I need to do a little extra.
Hi,
I was trying to implement your method since I also am dealing with multiple traversable graphs.
How did you obtained the second parameter graphIndex value?
Kind regards,
Stefano
 
Just giving everyone a heads up that I have sent a message to Aaron to see if we can add a generic version of getting the valid point.
 
Same issue here.
I have been pulling my hair out thinking its a variable I had set wrong, or not enough edge buffer.
But eventually ALL AI get stuck on edge trying to go off the area:
Screenshot 2021-05-26 181649.png
 
Last edited:
I contacted Aaron and he recommended a function that I should use. I let the demo scene play for awhile and it looked like it worked but I guess not? Are you using the most recent version of the integration?
 
Yes I believe so on latest version, It is a clean project with all downloads for A* (4.2.15) and integration all downloaded in the last week.
Unless there is a different location/version option for the download of the integration.

This is the link I'm using to get the BD integration:
 
Last edited:
It does sound like you are using the latest. Can you send me that scene? I'll send it to Aaron to see if he has any ideas.
 
Can do, will have to make a fresh project/scene to replicate it again, as I added the work around the adunato gave to get it working 'well enough' for now.
It might be mid week before I can do so, just had sinus surgery and sitting at PC more than 5 minutes my head feels like a balloon.
 
I was playing with the integration some and may have found a method that works - can you try downloading the new integration? If it still gets stuck feel free to send me the project.
 
Will do!
Didn't want you thinking I was ignoring the conversation. Complications came up, so out of service myself for a bit. Will check it out soon as I am able.
Thanks for looking into it!
 
Top