unity3d随笔-4

    xiaoxiao2021-03-25  47

    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; } }
    转载请注明原文地址: https://ju.6miu.com/read-150017.html

    最新回复(0)