1
void FixedUpdate()
{
///rotate character model if stick is tilted right or left, but only if character is moving in that direction.
if (IsInLocomotion() && ((direction >= 0 && horizontal >= 0) || (direction < 0 && horizontal < 0)))
{
Vector3 rotationAmount = Vector3.Lerp (Vector3.zero, new Vector3 (0f, rotationDegreePerSecond* (horizontal < 0f ? -1f : 1f), 0f), Mathf.Abs);
Quaternion deltaRotation = Quaternion.Euler (rotationAmount * Time.deltaTime);
this.transform.rotation = (this.transform.rotation * deltaRotation);
}
}
我的代碼的這一個特定部分給了我一個錯誤。如果有人會碰巧知道它到底有什麼問題,我將非常感激。我似乎在第九行結束時出現Unity錯誤
我不斷收到錯誤
資產/ CharacterControllerLogics.cs(100,58):錯誤CS1502:最好 重載方法匹配 `UnityEngine.Vector3.Lerp(UnityEngine.Vector3,UnityEngine。的Vector3, 浮動)」有一些無效參數
和
資產/ CHARACT erControllerLogics.cs(100,58):錯誤CS1503:參數
#3' cannot convert
方法組「表達鍵入`浮動」
DAM!非常感謝你老兄!完全幫助我!我用2f代替了42f,現在它工作了:)))!!!對不起,我喜歡這種類型的東西x) – user3858703 2014-10-22 11:55:55
@ user3858703:嘿,這就是我們在這裏!學習和教學。此外,由於您是新來賓,如果答案爲您提供了正確的解決方案,請務必將其標記爲已回答。乾杯! – 2014-10-22 11:57:33