I’m trying to get some AI characters chasing after the player, but I’m not having much luck getting this to look good.
I don’t think it makes too much of a difference, but I’m using C++ not blueprints.
If I use the AIController and move them with MoveToActor() using RVO, I get quite nice smooth motion and rotations and the AI movement looks quite nice. However, sometimes the AI will get stuck if it’s pushed off the navmesh.
If I switch the AI Controller Class to DetourCrowdAIController and turn off RVO, they don’t seem to get stuck anymore and find more interesting paths between each other, however the rotation is very jittery with the characters shaking right and left.
How can I get smooth rotation with the DetourCrownAIController?
Try turning off “Use Controller Rotation Yaw” (Under Pawn Settings) when using DetourCrowd AiController it is instantly snaps rotation of the pawn to whatever DetourCrowd solved.
Then go to Character Movement Component (in case you are using Character as Base class) and play around with “Rotation Settings” Set rotation rate to something resonable like 180 Yaw and tick Use Controller Desired Rotation/Orient Rotation To Movement (i think they are exactly the same values in this particular case)
I know this is an old post, but it was something that I was stuck on for ages and this is the first post that comes up when googling. In your animation graph, do a print string on your speed as well as your rotation. You will probably find that, as the detour controller, is working, the speed is dropping from, say, 195 to 0 every few frames. This causes your blend space to jump between your idle animation and your run animation, causing jittery animations. I’m not using a 2d blend space, but I imagine something similar is happening with rotation. The solution I used is twofold- add a buffer. So when the frames drop to 0 frames, I carry on using the previous speed for 0.2 seconds before actually allowing a speed of 0 through. This gives a bit of a buffer for those sudden drops. I then also use “fInterp To,” to smooth out any changes in speed.
I was having issues with DetourCrowd being incredibly jittery and I spent days trying to figure out why. I later noticed that when using “show navigation” command, the areas in which agents had the most jittering were entirely red. Not the orangey-red you see from NavArea_Obstacle regions, but a darker red, which indicates the nav mesh is being rebuilt if you are using dynamic nav mesh. I also confirmed that with CrowdSimulationState disabled, the jittering stopped entirely in the red areas. So, it seems the jittering was entirely due to the interaction of DetourCrowd inside nav mesh regions that are being rebuilt.
In any case, I later discovered that the reason the nav mesh was being rebuilt constantly was due to some level sequences I had playing in the area in which characters were holding props that had “Can Ever Affect Navigation” enabled, which is the default for static meshes. Because the props were moving it was triggering a constant nav mesh rebuild. After toggling affect navigation off for these props, the nav mesh turned green and the jittering stopped.
Tl;dr If you’ve tried a lot of options and can’t fix jitter, check if your nav mesh is red/rebuilding using “show navigation” command