1
當用戶按下upArrow時,我想用Quaternion.Lerp旋轉我的物體90度。但在每次旋轉後,我都能看到它不會將我的對象完全旋轉90度。它旋轉大約88度。問題是什麼?我怎麼解決這個問題?Quaternion.Lerp不會以精確的角度旋轉物體
if (Input.GetKeyDown(KeyCode.UpArrow))
{
to.eulerAngles = transform.eulerAngles + new Vector3(90, 0, 0);
from.eulerAngles = transform.eulerAngles;
direction = "up";
}
if("up".Equals(direction))
transform.rotation = Quaternion.Lerp(from, to, Time.deltaTime*10);
if (transform.eulerAngles==to.eulerAngles)
{
direction = "";
}