Path problem with target close to collider/Walls

Hi,

Im using a recast graph and I have a weird problem when the target (My player) is near a Collider.

The player is moved with axis, and the seekers are the AI, when my player moves near a collider the path returned to the seekers goes around the other side of the collider to try to catch him.

this is an example, initial position (the seeker stop at a distance of 2 units).
The Magenta sphere gizmo is the current waypoint in the path, the target is the small yellow sphere inside the red capsule (the player).
The seeker is the smaller yellow capsule (the green is a “client copy” of the server yellow seeker)

And when I move close to the collider the seeker goes around:

My Configuration is this :


I think the problem is the collider is surrounding for a hole in the navmesh generated by the RecastGraph, with one side bigger than the other as you can see in this example:

Am I doing something wrong?
How can I fix this?

PS* Im using a custom AIPath very simplified, and a funnel Modiffier.
cause I had problems with the original AIPath Script taking about 97ms to process the update call.
This is my custom AiPath:

I tryed to rotate the wall, move it, change the collider detail values, the terrain sample, ceil size, Max Edge Length, Max edge error, and always is the same, the non-walkable zone is always bigger in one side that the other.

I know I will need some check for walls, I can imagine something relative to raycast between the last path waypoint and the target to check if there is “walls” between them (I dont know how to ask for an alternative path or whatever needed to be done), But I need first to solve this problem, because the seeker always found an alternative path to get closer to the target because the distance of one side of the collider is bigger than the other side.

Hi

Yeah, in the current version there is a bug which causes the navmesh to be offset by roughly 1/2 voxel. Since your cell/voxel size is quite large (1 world unit) it will have a large impact on your navmesh.

Until I release an update (which should happen fairly soon) you can fix this bug by opening the VoxelRasterization.cs file and replacing the line

Matrix4x4 voxelMatrix = Matrix4x4.Scale(new Vector3(ics, ich, ics)) * Matrix4x4.TRS(-min, Quaternion.identity, Vector3.one);

with

Matrix4x4 voxelMatrix = Matrix4x4.TRS(-new Vector3(0.5f, 0, 0.5f), Quaternion.identity, Vector3.one) * Matrix4x4.Scale(new Vector3(ics, ich, ics)) * Matrix4x4.TRS(-min, Quaternion.identity, Vector3.one);

Hi,

It solved the problem, well, the edges of the generated navmesh were 2 close to the collider with the same configuration (weird), but I solved with a Max Edge error of 1. (a 0 value generated very weird edges).

Thanks !!

PS I tryed to reduce the ceil size to 0.5 world units, but the generated quality of the navmesh was almost the same, and edge errors appears:

while with a ceil size of 1 the edge was correct:

And the generated time was a Nightmare, (more than twice)

Hi

Also, generally for navmeshes the character shouldn’t usually go outside the navmesh. Your character seems to be moving very close to the wall, is that indended?

Well Im thinking about increase the box collider, right now this is a pathfinding laboratory, the real “world” is an open world, with mountains, valleys, hills, trees, rocks, etc, etc, and buildings, walls etc, so the final buildings and walls will have bigger colliders, to avoid this, But Im rasterizing the collider and terrain, not the meshes, So I can imagine that with a bigger collider the result will be the same.

Hi regarding the scan time. You might be interested in some bleeding edge changes I have made to improve the recast scan time for large worlds with many objects and large terrains.

Keep in mind that the recast graph resolution for you right now is 1 world unit, so it will never be able to represent smaller features than 1 world unit.

Maybe I will change for the final world, I dont know right now If it would be neccesary.

About the building I was thinking to use NavMeshCut cause they will be generated by the player. except few ones.