level 6
Great小卢XL
楼主
当我的摄像机的X轴逐渐增大,速度也就越慢。代码在下(全部的代码)
谁能告诉我为什么,怎么解决?
public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;
public Vector3 moveDirection = Vector3.zero;
void FixedUpdate()
{
CharacterController controller = GetComponentInParent<CharacterController>();
if (controller.isGrounded == true)
{
moveDirection = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if (Input.GetKey(KeyCode.Space))
moveDirection.y = jumpSpeed;
}
moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
}
2018年11月12日 14点11分
1
谁能告诉我为什么,怎么解决?
public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;
public Vector3 moveDirection = Vector3.zero;
void FixedUpdate()
{
CharacterController controller = GetComponentInParent<CharacterController>();
if (controller.isGrounded == true)
{
moveDirection = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if (Input.GetKey(KeyCode.Space))
moveDirection.y = jumpSpeed;
}
moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
}




