浏览代码

Change var name to more acurately show purpose

/main
Andrew Real 4 年前
当前提交
e23c8e72
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 4
      UOP1_Project/Assets/Scripts/Characters/Character.cs

4
UOP1_Project/Assets/Scripts/Characters/Character.cs


private float verticalMovement = 0f; //Represents how much a player will move vertically in a frame. Affected by gravity * gravityContributionMultiplier
private Vector3 inputVector; //Initial input horizontal movement (y == 0f)
private Vector3 movementVector; //Final movement vector
private float rotationSensitivity = .02f;
private float rotationThreshold = .02f; // Used to prevent NaN result causing rotation in a non direction
private void Awake()
{

//Rotate to the movement direction
movementVector.y = 0f;
if (movementVector.sqrMagnitude >= rotationSensitivity)
if (movementVector.sqrMagnitude >= rotationThreshold)
{
float targetRotation = Mathf.Atan2(movementVector.x, movementVector.z) * Mathf.Rad2Deg;
transform.eulerAngles = Vector3.up * Mathf.SmoothDampAngle(

正在加载...
取消
保存