using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Tank : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//旋转
float steer = 20;//旋转速度
float x = Input.GetAxis("Horizontal");//左右转动方向
transform.Rotate(0, x * steer * Time.deltaTime, 0);
//前后
float speed = 3f;
float y = Input.GetAxis("Vertical");//前后转动方向
Vector3 s = y * transform.forward * speed * Time.deltaTime;
transform.transform.position += s;
}
}
unity3d随笔-4
最新推荐文章于 2021-07-02 11:18:19 发布