Pivoting from NavMesh - Checking for supported functionality


#1

I’m consider moving from Unity’s NavMeshComponents system over to A* Pathfinding. I have a few different use cases that I either depend on in NavMeshComponents, or aren’t supported that I’d like to be able to use. Sorry if some of this is already covered elsewhere.

Pathfinding-only, without locomotion

In my game, I’m currently using NavMeshAgent to generate a path on the NavMesh, but I don’t allow the agent to move the game object. Instead, I use the path.corners waypoints as inputs to my custom physics-based movement script. Does A*PP support the ability for an agent to calculate its path, and make the path waypoints available to other scripts, so that I can continue to handle movement on my own?

Better NavMeshLink handling

Unity’s OffMeshLink/NavMeshLink system is kind of a mess. Either I can use the standard NavMesh with automatic OffMeshLink generation (but no support for multiple agent types), or I can use NavMeshSurface, which has no auto-generation of links, and requires links to be placed manually. What is APP’s approach to this? If I have a raised surface a few meters off the ground, and both surfaces are walkable, does APP automatically link the surfaces based on some jump height parameter? Or does it depend on manual link generation?

Dynamic Links

Using NavMeshComponents, I can rebake the mesh at runtime, and I can technically move NavMeshLinkEndpoints at runtime as well. So, technically it support dynamic links at runtime (such as a jump between two moving platforms). However, rebaking the navmesh at runtime is expensive, and causes framerate stuttering. Does A*PP have a better approach to this? The basic example is a platform that moves up and down, such that an agent should be able to jump up/down from the platform, even if the platform moves at runtime.

Jumping over obstacles

Unity’s navmesh system support obstacles, which cause agents to redirect around things in their way. However, some of my agents have significant jumping ability, such that they could easily jump over certain obstacles. With Unity, however, unless I try to create dynamic navmeshlinks over obstacles, my agents always just around objects they could easily jump over. This is probably an ambitious request, but does A*PP have any support for obstacles that either A) are short enough to jump over, or B) Obstacles that are themselves walkable surfaces, so that the agent can jump into it on its way?

Anyway, that’s a lot of questions. Thanks for any insights.


#2

Hi

1 Pathfinding-only, without locomotion
Yes, that is supported. See https://arongranberg.com/astar/docs/callingpathfinding.html

2 Better NavMeshLink handling
Off-mesh links are unfortunately one of the parts I am the least happy with in this package. There is no automatic off-mesh link creation, you will have to create them manually (or using a script).

3 Moving an existing off-mesh link can be done. The most performant way is probably like this:

// Updates must be applied when pathfinding is paused
AstarPath.AddWorkItem(ctx => {
    link.StartTransform.position = whatever;
    link.EndTransform.position = whatever;
    // Update the link
    link.Apply(true);
    // Keep metadata up to date
    ctx.QueueFloodFill();
});

Rebaking the navmesh is quite slow in my package as well (at least if you use a recast graph). However it can be done on a tile-by-tile basis (i.e you don’t have to rebake the whole navmesh), and this can be quite fast (most of the update is also multithreaded to avoid affecting the frame-rate). Here is a small demo showing that: http://arongranberg.com/temp/recast_dynamic_updates.mp4. This was on a quite simple navmesh however.
You might be able to use navmesh cutting for it with some tricks, and that is significantly faster: https://arongranberg.com/astar/docs/navmeshcutting.html

4 Jumping over obstacles
Jumping over obstacles is not something I have attempted personally. There is no built-in functionality for automatically generating jump-links like that.