private void FixedUpdate() { Vector3 euler = transform.eulerAngles; euler.z = UtilMath.ApproachAngleDegrees(euler.z, upDirection.GetUpAngle() - 90.0f, rotationSpeed * timeScale.DeltaTime()); transform.rotation = Quaternion.Euler(euler); }
private void FixedUpdate() { Vector3 euler = transform.eulerAngles; euler.z = Angle.FromDegrees(euler.z).ApproachCoterminal( upDirection.GetUpAngle().AddDegrees(-90.0f), rotationSpeed * timeScale.DeltaTime()) .GetDegrees(); transform.rotation = Quaternion.Euler(euler); }
private void FixedUpdate() { Vector3 euler = transform.eulerAngles; euler.z = Angle.FromDegrees(euler.z).Approach( upDirection.GetUpAngle().AddDegrees(-90.0f), Angle.FromDegrees(rotationSpeed * timeScale.DeltaTime())) .GetDegrees(); //UtilPeriodic.Approach() /* * UtilApproach.AngleDegrees(euler.z, * upDirection.GetUpAngle() - 90.0f, rotationSpeed * timeScale.DeltaTime()); */ transform.rotation = Quaternion.Euler(euler); }
// Gets the angle that corresponds to the current up direction. private Angle GetUpAngle() { return(upDirection.GetUpAngle()); }
// Gets the angle that corresponds to the current up direction. private float GetUpAngle() { return(upDirection.GetUpAngle()); }