Rotation Speed doesn't go beyond certain speed

Hi Aron,

I’m using RichAI and it’s moving towards the player using “seeker.StartPath(AI.position, player.position)”.
I want it to rotate fast towards player when he starts running around the A.I.
For some reason, setting RotationSpeed only makes it turn up to certain point, which still seems pretty slow and it doesn’t get any faster than that. I tried setting it to 1 and it clearly works because the A.I. starts rotating very slowly, then when I turn it back up it goes back to it’s max slow speed.

Is there any way to make it rotate any faster?
If need be I can shoot a vid and link it here so you can see how slow it is (let me know).

Hi

This is due to the fact that acceleration also limits how quickly the agent can turn.
It may be unintuitive, but it’s pretty straight forward from a physics point of view (see https://en.wikipedia.org/wiki/Centripetal_force). More specifically the angular speed of the character is limited by ω < a/v where ω is the angular speed (rotation speed in radians per second), a is the agent’s acceleration and v is the agent’s speed. In the future I plan to change the RichAI script so that it doesn’t use a single acceleration but instead uses one acceleration value for the forward/backwards direction and one acceleration value (determined by the rotation speed) for the left/right direction. That should fix this issue.
Long story short: you can increase the rotation speed of the character by increasing its acceleration.

1 Like

I know this is an old thread but I found an easy way of making an AIPath character turn instantly.

Adding this line before MovementUtilities.CalculateAccelerationToReachPoint inside AIPath.cs
will make your character turn instantly if difference between target direction and current one is more than 90°.
if (Vector2.Dot(velocity2D.normalized, dir.normalized) < 0.0f) velocity2D = dir.normalized * maxSpeed;

Obviously this change is really specific to my case, and might not apply to everyone.

Also. I have fixed this issue in my development version now and I expect it to be included in the next update.

1 Like

Was this ever added into the latest build? Whenever I have a character move one direction, stop movement using isStopped/canMove then after a few seconds reactivate it with the direction set behind the character, the character initially moves forwards for a second or two before turning around again towards the set destination.

Turning the velocity up causes the character to turn around faster. Note this is different from Rotation Speed as that is more how fast the character turns once it is rotating but in this scenario, the character continues to move forward for a second or so before starting to turn around even though it has been effectively stopped by canMove for 2 seconds and the destination is now set directly behind it.

Hi

That sounds very much not like a rotation speed issue but instead what you are seeing is that the agent only recalculates its path a regular intervals (controlled by the repath rate field). If you want to force it to recalculate the path immediately you can call ai.SearchPath.