Created
April 1, 2016 03:38
-
-
Save SnugglePilot/fd6db950e3a30cd04d89a6dea6b79bce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rotTrackingTimeLeft -= Time.deltaTime; | |
Vector3 eulerAngles = this.transform.rotation.eulerAngles; | |
eulerAngles.x = Mathf.SmoothDampAngle(eulerAngles.x, targetRotation.eulerAngles.x, ref rotVel.x, rotateTime, Mathf.Infinity, Time.deltaTime); | |
eulerAngles.y = Mathf.SmoothDampAngle(eulerAngles.y, targetRotation.eulerAngles.y, ref rotVel.y, rotateTime, Mathf.Infinity, Time.deltaTime); | |
eulerAngles.z = Mathf.SmoothDampAngle(eulerAngles.z, targetRotation.eulerAngles.z, ref rotVel.z, rotateTime, Mathf.Infinity, Time.deltaTime); | |
if (float.IsNaN(eulerAngles.x) || float.IsNaN (eulerAngles.y) || float.IsNaN (eulerAngles.z)) { | |
// Woops. I don't know why this is the case. TODO: Find out why and fix later. | |
//Debug.Log ("1:"+this.transform.rotation.eulerAngles); | |
//Debug.Log ("2:"+targetRotation.eulerAngles); | |
// ^^ Always the same?! | |
} else { | |
this.transform.rotation = Quaternion.Euler (eulerAngles); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment