- Home /
Question by
Vefery · Jun 03, 2018 at 11:38 AM ·
charactercontrollervelocity
CharacterController.velocity always return 0
I'm check Velocity in Update like that:
Vector3 moveVector = (cam.transform.right * joystick.Horizontal + cam.transform.forward * joystick.Vertical);
moveVector.y = 0.0f;
moveSpeed *= moveVector.magnitude;
if (controller.isGrounded) {
controller.Move (moveVector * moveSpeed * moveVector.magnitude * Time.deltaTime);
if (cam.transform.localPosition.y <= -0.01f && timeout <= 0f) {
PlayStepSound ();
timeout = 0.6f;
}
}
controller.SimpleMove (Physics.gravity * 3 * Time.deltaTime);
Debug.Log (controller.velocity);
But it's always return (0, 0, 0). But if I change player's y-axis y-velocity react correctly
Comment