I’ve put this under Recast as I’m using a Recast graph. I also posted it before but it didn’t get a reply for one reason or another, so I’ll post again and try to explain the issue.
As shown in the GIF the agent passes their nearest steeringTarget/ corner and a few frames later the path goes to the previous corner again. The Repath Rate is set to 1 in this example.
I thought the issue could have been to do with the navmesh, as there are a lot of irregualar shapes in the scene, however, I exported the mesh to Blender and it’s flat/ as expected. I also thought it could be the funnel modifier in RichAI component but I turned that off and noticed the issue again.
It’s a strange issue and I’m really not sure what it could be. I’ve been fiddling with settings for a few months now to get the best feel. I also can’t remember when the issue cropped up/ after which change…
It is mitigated slightly if I turn on SlowWhenNotFacingTarget but the agent animations don’t look their best and realism is incrediably important in this project.
I’m thinking now it could be something to do with the Seeker so i’ll have a fiddle with that next.
Any help or advice would be much appreciated as it’s making my agents look like they’re slightly mad.
Hi, thanks for the reply. I’m just converting the Recast to a NavMesh. Going to retopologise it in ZBrush as it’s a bit of a polygon soup at the moment. Once I’ve imported it back into the project I’ll test it again.
edit: realise that may have come across rude. The polygon soup is just a product of having a complex scene layout.
So I sorted the Recast mesh and re-imported it into the project as Navmesh… The same issue is still coming up so I’ll send over some more info. Maybe, there’s something I’m missing…
Hey,
Thanks for getting back to us with the info.
I can’t see anything really wrong here. So you might have to wait till Aron gets back and can help you out.
I’d try putting your agent in the Recast or Navmesh example scenes, and see if it works there.
Second you might also be interested in using the RichAI movement script as it’s supposed to work better for Recast and Navmesh graphs.
PathAI is extending RichAI just with a couple of additions. I’ve tried it on a 5x5 plane using a Recast and I didn’t see the issue either.
It almost looks like the distance from the waypoint isn’t reached despite how close they get. However, when it passes the corner point it repaths using the previous corner. I also lowered the Hueristic scale thinking it could be the quality of the search but that hasn’t helped
Just adding some more findings into the pot… As to be expected the FindNextCorner() is recalculating the next corners. In the gif the red is nextCorner[0] and cyan is nextCorner[1]…
Disabling the RVOController doesn’t change anything unfortunatly and I’m using a slightly modified version of the MecanimBridge script. The only difference is that I’m setting the deltaPos.y to the NearestNode using GetNearest() and the following…
If I was able to raise the distance the agent needs to be to the corner before it updates, maybe that will mitigate the issue…? I’m using slowDownWhenNotFacingTarget but it creates an unnatural effect.
Ah. You are using root motion. I think that’s the core problem. WIth root motion the agent may not actually move in the way the RichAI script expects it to. This could for example lead to it not actually passing the waypoint inside the navmesh (it might be slightly outside it for example). If this happens the RichAI script will think it hasn’t passed the waypoint and will turn around to try to reach it.
I would suggest that you try extending from the AIPath script instead. It can handle being slightly off-target a bit better than the RichAI script. Another approach you could use is to set ai.updatePosition = false and ai.updateRotation = false. This will decouple the position and rotation of the agent from the Transform position and rotation. In a separate script you could then try to make the root motion character try to follow the same path as the invisible ai script.
Here is a unity tutorial that touches on the same subject, it might be useful. See the bottom of this page: https://docs.unity3d.com/Manual/nav-CouplingAnimationAndNavigation.html