Hey,
I hope you understand my explanation
if we click on the right side of the actor then the angle between movement and right vector will be from 0 to 90 degrees.
if we click forward or back then the angle between movement and right vector will be 90 degrees.
if we click on the left side of the actor then the angle between movement and right vector will be from 90 to 180 degrees.
First line calculate angle between movement and right vector.
Next lines are:
if(SignAngle > 90.0f) // Turn to Left
{
signAngle = -1.0f;
}
else // turn to Right
{
signAngle = 1.0f;
}
// change sign of the angle
holdAngle *= SignAngle;
you can also write it like that (instead of code from my previous post):
if(angleBetween2Vectors(GetActorRightVector(), movement) > 90.0f)
{
// We turn to Left so change the angle sign to a negative
holdAngle = -holdAngle;
}
Cheers,
Shaggy41