Hello everyone.
Here is my script.
void povorotNaVraga()
{
Vector3 relativePos = Personag_vrag.teloPersonaga.transform.position - transform.position;
rot = Quaternion.LookRotation(relativePos);
transform.rotation = Quaternion.RotateTowards(transform.rotation, rot, Time.deltaTime * 400);
if (Mathf.Abs(Quaternion.Dot(transform.rotation, rot)) <0.99f)
{
povorotBool = false;
}
else
{
transform.rotation = rot;
povorotBool = true;
}
}
What needs to be fixed in my function? Or maybe a better way?