组件Character Controller 中文角色控制器
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class player : MonoBehaviour
{private CharacterController player;void Start(){player= GetComponent<CharacterController>();}void Update(){//水平轴float horizontal = Input.GetAxis("Horizontal");//垂直轴float vertical = Input.GetAxis("Vertical");//创建成一个方向向量Vector3 dir = new Vector3(horizontal, 0, vertical);//打印向量//Debug.DrawRay(transform.position, dir, Color.red); //朝向该方向移动//无重力影响player.Move(dir);//有重力影响// player.SimpleMove(dir);}
}