移动代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class player : MonoBehaviour {
    public int speed = 2;
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
        float h = Input.GetAxis("Horizontal");//水平 ad
        float v = Input.GetAxis("Vertical");//垂直输入量 ws

        Vector3 moveVec = new Vector3(h, 0, v);
        transform.Translate(moveVec * speed * Time.deltaTime);
		
	}
}

猜你喜欢

转载自blog.csdn.net/weixin_41796913/article/details/84201782