Support Forum

RVOController pathfinding delta not avoiding walls

Hello! I’m working on a project using the pathfinding system to calculate the paths, with a custom solution for movement. I’ve been having problems when it comes to the RVOController side of things, where the delta returned by the function CalculateMovementDelta is pointing my NPC’s straight through walls. Does anybody have any ideas as to why is this happening?

I can use the regular seeker with the function CalculatePath normally: The pathway drawn perfectly navigates my map avoiding walls and whatnot. But since I want to have certain avoidance of other NPC’s in the map, especially when positioning themselves for attacking the player, I really have to go through the RVOController if I understand the documentation correctly.
All NPCs in the project have the RVOController, and I’m testing the direction using raycasts. RVOSimulator is on scene as well, with the X and Z planes being toggled. Any ideas would be apreciated!

…did nobody used this function? Maybe I didn’t explain something in detail?


Local avoidance doesn’t care about walls as such. The built-in movement scripts will clamp the agent’s to the navmesh and inform the local avoidance system if there’s a collision with the wall. But if you only use the RVOController directly then it will have no idea about any walls in the scene. Is this the case for you?

Kindda, yeah. Since we use the seeker.StartPath to calculate the path, but only use the next one or two nodes in the vectorPath to get the directional vector, and pass that to our own movement system, we’re missing a bit of avoidance between agents that grants us a bit more of that organic movement. I was trying to use the RVOController in order to get that avoidance calculation in the path nodes, but as you’ve said, the delta returned ignores walls, so we get unwanted behaviours.

Is there a way for the path created by the StartPath (as returned by the .vectorPath[]) to account for dynamic agents in the mesh? As in, other NPCs in the scene, with the seeker component or whatnot?

No. That’s a significantly harder problem called cooperative pathfinding. Local avoidance generally solves it much better.

I would recommend that you clamp the agent to the navmesh every frame. Take a look at AIPath.ClampToNavmesh for reference :slight_smile:

1 Like

I’ll take a look, thanks!

I ended up using a mixed solution for this in the end. I used the vectorPath() to get a directional vector to the next point in the path, and then I calculate the middle vector between that, and the CalculateMovementDelta avoidance delta as given by the RVOController. It is by no means a perfect solution, but it lerps the movement in a nice mixed way between Pathfinding and Local Avoidance. Brings back the days of trying to simulate seeker behaviours :grin:.

Thanks for the reply man! Will take a look at better solutions for this problem some other time, but thought I’d leave my temporary solution here in case it helps anybody else. Maybe that ClampToNavmesh will finally solve it!


1 Like