Recast graph, can't go on elevations


I’ve got another problem with the recast graph - My characters go on correct paths but they don’t go up/down.

Here are my options

Does anyone know how to fix that?

Still looking for an answer. Bump

So the issue here is that the agent doesn’t move in a straight line to the target if I understand you correctly?

This is unfortunately an issue with navmeshes in that sometimes they do not produce the most optimal path.
This is described a bit more here:

The RichAI movement script has an option for ‘Funnel Simplification’ which tries to use graph raycasting to make the path more optimal after it has been calculated. This is unfortunately not yet implmented for the AIPath script.

Usually these issues are most prominent on large open regions. If you can add some small obstacles that break up the world then it might work better.

No, the issue here is that the agent should move on the elevated plane, but instead, he goes into it.

Ah. I see.
I think you want to turn the ‘Gravity’ option in the AI settings back on then. If gravity is off then it will not do any checks for where the ground is.

Unfortunately it did not work :frowning: Any more ideas?

Ok, it was a bug on my behalf. When I overrided the base function FixedUpdate from AIPath I forgot to use useGravity variable. Well the effect is not really what I was looking for… I mean, After using this variable, my performance dropped significaly. And it works fine when it goes down the stairs but there’s a “jump” when he’s going up.

Still looking for an answer. Is there a way to optimize it and make it work when its going from bottom to top?

Huh. That really shouldn’t change the performance much at all. It should essentially just be a single raycast done per frame which isn’t that expensive.
How much does your performance drop? How many agents are you using?

I’m using about 300-500 agents and the performance drop by 30-40%

Ah. Yeah with 300-500 extra raycasts per frame, that will add up I suppose.
Unfortunately there is not that much that can be done.

In another game I have worked on I optimized it by only performing the raycasts every N frames instead of every frame which helped a bit, but there is no such option out of the box in this package.

How about changing the directions in which agents are going to threedimension vectors? Because right now calculations are done with twodimensions and at the end the gravity is added. How about going in threedimensions all the way?

As you can see in the first image that you posted in this thread, the navmesh is usually not that precise along the Y axis as that is not its goal.
This is why raycasting is usually used to place the character more accurately on the ground.

Do you really need all your agents active at the same time?

Yes, it is RTS and all the agents should be active all the time

Well then, what is the lightest way to operate hundreds of agents with RVO and stuff? Is there a way to implement AILerp with RVO?

The lightest way is to either implement your own movement script or start from an existing one and strip out/simplify all features that you do not need. It’s hard for me to provide a more optimized movement script because every game requires different features.

AILerp is inherently incompatible with RVO as that movement script follows the path precisely by design, it is not possible for it to deviate from the path.