So I’m currently using this little bit of code to get a character to match the rotation of a marker after they’ve reached it:
public IEnumerator FinalNavRotation(Quaternion walkEventRotation) {
initialRotation = transform.rotation;
desiredRotation = walkEventRotation;
turnTime = 0f;
while(turnTime < .5f){
transform.rotation = Quaternion.Slerp (initialRotation, desiredRotation, (turnTime * 2));
turnTime += Time.deltaTime;
yield return new WaitForEndOfFrame ();
}
yield break;
}
What I’m trying to figure out now is how to only get this rotation to happen to match the Y value of the destination marker’s rotation. Right now it’s trying to match all three and sometimes for whatever funky reason the marker’s x or z rotation values might get a little bit screwy and then my character ends up tipping over.