Hi there,
This must be a really stupid question, but my trigonometry is very rusty so I’m having trouble sorting this out:
I am making a character rotate on the Y-axis using Mathf.SmoothDampAngle(). I need to know when it has fully rotated to its destination.
Here’s a snippet from my code:
Vector3 delta = targetPosition - transform.position;
float targetAngle = Mathf.Atan2(-delta.z, -delta.x);
float currentAngle = transform.localEulerAngles.y;
currentAngle = Mathf.SmoothDampAngle(currentAngle, -targetAngle * Mathf.Rad2Deg - 90, ref rotationVelocity, rotationSmoothTime);
transform.localEulerAngles = new Vector3(0, currentAngle, 0);
Help anyone? ![]()