当我向下滑动操纵杆向下移动时,操纵杆无法按预期工作,反之亦然,当我推高列车向下移动时。
我想反过来说。
这是代码
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 :(得分:0)
在TrainSpeed之前添加一个减号:
transform.Translate(0f, 0f, -TrainSpeed * CrossPlatformInputManager.GetAxis("Vertical") * Time.deltaTime);