using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerControl : MonoBehaviour
{
public float moveSpeed = 1;//移动速度
public float rotateSpeed = 5;//旋转速度
public Rigidbody Rigidbody_self;//玩家刚体
public Camera Camera_self;//相机
private float keyh;//键盘左右
private float keyv;//键盘上下
Vector3 c;//指向玩家单位向量
void Start()
{
c = (transform.position - Camera_self.transform.position).normalized;
}
void Update()
{
Move();
}
//键盘控制角色变换
public void Move()
{
keyh = Input.GetAxis("Horizontal");
keyv = Input.GetAxis("Vertical");
float inputMotionValue = Mathf.Max(Mathf.Abs(keyh), Mathf.Abs(keyv));
c = (transform.position - Camera_self.transform.position).normalized;
string s = transform.localEulerAngles.ToString();//欧拉角
string[] sarr=s.Spl
【Unity】第三人称:控制角色移动
最新推荐文章于 2025-03-26 16:54:45 发布