# Unity 3D rotationThisFrame parameter(疑問已解決) 在 public void RotationApply(float rotationThisFrame)中 (float rotationThisFrame)是一個參數,表示這個方法需要一個float值才能執行。 當我們呼叫RotationApply時, 調用方法內的float值會被存處在float rotationThisFrame。 也就是rotationThisFrame = RotationSpeed || rotationThisFrame = -RotationSpeed 而根據按下不同的鍵,會回傳不同的值,就可以完成按下不同鍵往不同方向旋轉。 ```C#= void ProcessRotation() { if (Input.GetKey(KeyCode.A)) { RotationApply(RotationSpeed); } else if (Input.GetKey(KeyCode.D))//Left跟right不同時進行 { RotationApply(-RotationSpeed); } } public void RotationApply(float rotationThisFrame) { transform.Rotate(Vector3.forward * rotationThisFrame * Time.deltaTime); } ``` ###### tags: `unity`