2016-08-05 67 views
0

當我向下滑動操縱桿時,操縱桿無法按預期工作,反之亦然,當我推動列車向下移動時。屏幕上的操縱桿統一爲5

我想反轉。

這裏是代碼

using UnityEngine; 
using System.Collections; 
using UnityStandardAssets.CrossPlatformInput; 

public class joystick : MonoBehaviour { 
    public float TrainSpeed = 50; 
    public float TrainRotateSpeed = 50; 
    // Use this for initialization 
    void Start() { 

    } 

    // Update is called once per frame 
    void Update() { 
      transform.Translate(0f, 0f, TrainSpeed *   CrossPlatformInputManager.GetAxis("Vertical") * Time.deltaTime); 
     transform.Rotate(0f, TrainRotateSpeed * CrossPlatformInputManager.GetAxis("Horizontal") * Time.deltaTime, 0f); 

} 

}

回答

0

TrainSpeed前添加一個減號:

transform.Translate(0f, 0f, -TrainSpeed * CrossPlatformInputManager.GetAxis("Vertical") * Time.deltaTime); 
+0

謝謝你,我會嘗試,我知道一個 - 必須去的地方 –