Point Graphs stop between nodes


#1

I’m trying to implement AI swimming in my game, to have ocean predators. I thought I could do this using a Point Graph with large distances between the nodes to not have performance/memory issues, however after trying it out it seems that it navigates directly to other nodes, and not just anywhere between nodes as I had hoped for. Is there a way to accomplish what I’m looking for, without a huge performance hit on a decent size ocean (3km).


#2

Hi

The only thing point nodes know is that there is a walkable point right at the node’s position, the graph has no idea if an empty space between nodes is an obstacle or free space. For this a graph such as the recast graph or the navmesh graph are much better suited.

You can get sort of get what you are looking for by changing the settings on the Seeker -> Start End Modifier.
See also https://arongranberg.com/astar/docs/startendmodifier.html#Exactness


#3

It’s swimming, so I need 3d navigation. My understanding is you can’t do that with a recast/navmesh graph?

As to obstacles, that’s fine for my use case. There’s going to be very little in the way of obstacles in the ocean, so even if there’s a rare case they swim through something, that’s much better than the alternative of not having any water based AI at all. So is there something I could modify to accomplish what I am looking for?


#4

Ah I see. Well, setting Start Point and End Point to ‘Original’ in the Seeker’s Start End Modifier is the closest you will get probably.


#5

That seems to work perfectly, thank you!

Couple other questions now that that is resolved. I use AIPath for on the land, and I’d like to be able to have creatures that can transition from land to water, and water to land. When I tried to use AIPath for the water though, it doesn’t move on the Y axis, so I had to change it over to an AILerp. What would you recommend to smoothly transition from the point graph to a recast graph and vice versa?


#6

Hi

I think the best solution is probably to write your own movement script that can work both in water and outside water. That will be able to give you a smooth transition.

Otherwise disabling the AIPath component and then enabling the AILerp component at the appropriate time should work reasonably well. You could possibly have an animation when the agent is moving into the water or out of the water to mask the transition.


#7

Okay I’ll give that a shot, thanks. I think my only other issue is that with the start/end point set to original, they can navigate outside of the point graph. Any way to keep them still contained within? Or will I have to manually handle that with the destinations I provide? If I do have to provide it, is there an API for that already?


#8

Hi

The issue is that with point graphs there is no way to clearly define an “inside” and and “outside”.
Maybe you could clamp it so that the end point is at most a specific distance away from the closest node though.