using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour {
private Rigidbody rig;
public float speed = 5;
// Use this for initialization
void Start () {
rig = this.GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
rig.AddForce(new Vector3(h, 0, v) * speed);
}
}
Unity通过钢体使角色移动
最新推荐文章于 2023-12-14 22:44:46 发布