RichAI/RVO Frequent Rotation Jittering

Using version 4.2.16 with RichAI agents using RVO @ 60fps and recast graphs.

Demo: https://puu.sh/Iw41C/6d35f09c8d.mp4

I’m experiencing some jarring rotation shifts in my AI which I’m assuming is due to constant changes in velocity. I was wondering if anyone has ideas on how to go about fixing this before I try to throw together some more hacky solutions.

The rotation speed is currently 400 for these agents as I want them to be able to do 180 degree turns relatively quickly, but I need to find some way to smooth out these frequent jitters. I’m fine with having a slower rotation when not doing large turns or having a sort of ramp up effect when doing big turns as a result of smoothing, but I’m not entirely sure how to implement this with the way rotation is handled in the package (it being based off of the frame position delta).

Appreciate any suggestions/help, thanks!

Hi

The beta version has a fix for this. However, I’m not super happy about that fix, since it makes some other behaviors worse. Might work for your use case, though, so you could check that out if you want. You can download the beta here: A* Pathfinding Project

Thanks for the help Aron, I wasn’t aware of the beta.

I have gotten almost everything working after updating to the beta version, however I’m getting this error shown in the screenshot below (part of a function that sets a random path) which I’m not sure how to fix, do you have any idea? I tested the project with this random pathing behavior removed and it works, the rotation is much smoother as well.

As a bit of an aside I’m curious which behaviors you’re referencing that are made worse in the beta.

Thanks again!

Hi

You probably need to rebuild your C# project files. Unity has a menu item to do this.

I’ve tried that but unfortunately it didn’t fix the issue. It isn’t just one of those fake errors in the IDE either, it prevents me from entering play mode in Unity.

There really should be a better way to smooth out the the constant rotation jitter (especially with RVO), it just makes the characters spaz out too much. But fortunately there is a work around solution.

You can try and mitigate the jitter by separating your visual 3D object from your root object by making it a child object and introduce some rotation lag like so


Quaternion characterRotation;
float rotationLerp = 0.1f
void LateUpdate()
{
 characterRotation = Quaternion.Slerp(characterRotation, parent.transform.rotation, rotationLerp );
 transform.rotation = characterRotation;
}