unity:⼈物移动代码(通⽤式)常⽤的移动代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Yd : MonoBehaviour
{
public float speed;
// Use this for initialization
void Start()
{
speed = 5f;
}
// Update is called once per frame
void Update()
{
float vertical = Input.GetAxis("Vertical");
float horizontal = Input.GetAxis("Horizontal");
transform.Translate(new Vector3(horizontal, 0, vertical) * Time.deltaTime * speed);
}
}
对您有帮助的话, 求给个三连吧!html代码转链接

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。