我一直試圖讓它自己向前移動,並以圓形方式左右旋轉,如果用C#統一按下左/右鍵,這張圖片會使它更清晰的:http://prnt.sc/avmxbn使用Unity中的C#鍵改變玩家的方向
我只能讓它自行移動,這是我到目前爲止的代碼:
using UnityEngine;
using System.Collections;
public class PlayerBehaviour : MonoBehaviour {
Update(){ transform.localPosition += transform.forward *speed *Time.deltaTime
float speed = 5.0f;
// Use this for initialization
void Start() {
Debug.Log ("it's working?");
}
// Update is called once per frame
void Update() {
transform.localPosition += transform.forward * speed * Time.deltaTime;
}
void FixedUpdate(){
}
}
我不知道,但是,如何改變向左或環形路徑中的正確方向,如圖片鏈接數字化onstrates。任何人都可以幫助我?謝謝。
你想讓自己的運動變得像運動一樣嗎?或者是直線的UpDownLeftRight線條是彎曲的? –
@YotamSalmon我希望這會讓它更清晰,我希望當按鍵沒有按下時,它會沿連續的方向走,但是當按下左右鍵時,球員的路徑應該開始朝着鍵的方向彎曲被按下 – rBai
你忘了添加你的代碼嗎? –