- Home /
Question by
ExtremePowers · Dec 25, 2014 at 08:31 PM ·
charactercontrollersensitivityisgrounded
isGrounded too sensitive?
Why is isGrounded so sensitive?
if (controller.isGrounded) {
moveDirection = Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
var sprinting = Input.GetButton("Sprint");
if (moveDirection != Vector3.zero) {
anim.SetFloat(SpeedHash, 1);
} else {
anim.SetFloat(SpeedHash, 0);
}
moveDirection = transform.TransformDirection(moveDirection);
if (Input.GetButton("Sprint")) {
anim.SetBool(SprintHash, true);
moveDirection *= sprintSpeed;
} else {
anim.SetBool(SprintHash, false);
moveDirection *= speed;
}
if (Input.GetButton("Jump")) {
moveDirection.y = jumpSpeed;
}
} else {
Debug.Log("Character is in the air, I repeat character is in the air");
}
It is almost constantly printing the string to the log.
Comment
Should I do an alternative as raycasting to the terrain and see if the distance is greater than 1, would this be a better way of doing it?
I found out that my character's controller/collider isn't touching the ground, it is always floating a little over the terrain:
screenshot 2014-12-26 17.26.30.png
(11.0 kB)
Your answer
Follow this Question
Related Questions
Character Flying around uncontrollably 2 Answers
Controller Joystick Sensitivity 1 Answer
Enemy Character Controller 1 Answer
Mecanim and Child Objects 0 Answers
My Character Doesn't Move Properly 0 Answers