Is it possible?

We are going to use RecastGraph with custom character movement controller. The idea is not to use physics engine but stick only to a navmesh while controlling character movement from the input.

  1. Am I correct saying that I need to use NavmeshController as the base class for that purpose?

  2. Slope on a) has too big angle. Is it correct that NavmeshController.SimpleMove won’t let movement up the slope?

  3. Will NavmeshController.SimpleMove allow to slide down from the slope on b) ( slope angle is the same as on a) )?

[https://monosnap.com/file/w8ghTHlgmDNWv0ijcOLKTT4KE8axAR]

  1. After navmesh is generated we have indent from the world’s mesh edges. Is it possible to detect while building navmesh if we are near the wall then use that indent and if we are let’s say on a balcony we want to build navmesh exactly on a balcony’s edge(zero indent)?
  2. I did not find in the docs. Does your system autogenerate off mesh links?
  3. How does NavmeshController.SimpleMove take into account off mesh links?

Thanks for you time. If something is not possible but you have ideas how to implement it, please share )

Hi

I think you have gotten confused somewhere. There is no class called NavmeshController in my package, and neither is there is Unity’s package, so I’m not sure where you found that name.

  1. This is currently not possible, due to how it is implemented the navmesh will be reduced by the same amount everywhere.
  2. No, my package does not autogenerate off mesh links.

Is that it? https://arongranberg.com/astar/docs_beta/class_navmesh_controller.html#a39834e7e7abd94d5b785becce3b9e5db

Ah. Yeah that’s an old script which could be used if you wanted e.g a player character to move along the navmesh. It has not been included in the package for quite a long time (you are looking at the documentation for 3.1.4 which is 5 or 6 years old).

If you want to do a similar thing in the current version, I would recommend to use the included NavmeshClamp example script, which does something very similar to what the NavmeshController did. Every frame it does a linecast on the graph from the agents previous position to its current position, and then makes sure that the agent does not leave the navmesh if the linecast should happen to have hit a border of the navmesh.

If you don’t want to use any physics for the y coordinate, then you could also call this every frame:

// Find the point on the navmesh to the current position in xz space
// i.e we ignore any y coordinate differences, this is important in slopes as otherwise the agent would get slowed down since it would otherwise be pushed slightly backwards when it would be moving up the slope.
var nn = NNConstraint.Default;
nn.distanceXZ = true;
transform.position = AstarPath.active.GetNearest(transform.position, nn).position;

Oh sorry I missed version of that docs ). Thanks for your reply. Now I am thinking that I am actually need somehow to mark triangles while building navmesh. I mean I need to say for triangles of a slope that they are walkable from top to down but not walkable from down to top. And then I need take that into account while using my movement controller. It would be great if NavmeshClamp ignored unwalkable nodes. Is that true?

Also I found somewhere on this forum post about not accurate building navmesh along the scene’s mesh. And you suggested to use raycast down to correctly position agent by height. Unity has optional height mesh for this. Do you have something similar?

Ah. Running it without Unity is a much larger problem I’m afraid. This package depends on Unity for quite a lot of things. There are people who have managed to make parts of it run outside of Unity, but it is not supported out of the box I’m afraid.

There is no built in functionality for marking a triangle with that info for pathfinding purposes. However you could mark it with a tag (see docs) and then use then use that info in your player’s movement script. I.e if it is standing on a node with a specific tag, then the movement is restricted so that it cannot move upwards on the slope.

Yeah I am going to have ai that will use pathfinding. My goal is to use the same navmesh for moving character and ai agents. As for not using physics…I want this to be running on a server side ideally without unity at all ) or at least with no physics.

So one question left ). Is there a way to mark slope walkable from top to bottom and unwalkable from bottom to top?

“So one question left ). Is there a way to mark slope walkable from top to bottom and unwalkable from bottom to top?”

There is nothing built in for that I’m afraid. Surfaces are the nodes in the pathfinding graph, so due to the representation if and agent can move to a particular triangle, it is assumed it can move anywhere inside that triangle. You can tweak the connections from the triangle though.