- Home /
CharacterController and Animator components together damage isGrounded variable behaviour
Hi guys, how are you?
I have a big problem here! If someone could help me. I am creating a 2D platform game with Unity 4.3. I created a component which is basically a sprite (from Unity 4.3), a characterController and a Animator component.
Before I added the Animator component everything was working properly, but now, the animations are working but the variable CharacterController.isGrounded
is always defined as false
. Therefore, my jumps are not working.
Oh, I also notice that if i check the option Animate Physics and let the player above a platform for a while, the variable isGrounded will be true in a short period of time.
Does someone know how to fix this?
Here is a part of my code:
// if is jumping, apply gravity. Otherwise, process vertical movement.
if (!controller.isGrounded) {
[...]
if (movement.x != 0) {
animator.Play("Running");
}
} else if (Input.GetButtonDown("Jump")) {
movement.y = PlayerModel.JUMP_SPEED;
animator.Play("Jumping");
}
Hey guys, just wanted to say that I found the solution last night. I just had to leave the option Apply root motion
unchecked, at the Animator
.
Your answer
Follow this Question
Related Questions
OnCollisionEnter/Stay not working when jumping on Enemy 0 Answers
Physics AddForce reduced when 3 objects are colliding 1 Answer
How to trigger different animations depending on where a gameobject collides? 1 Answer
OnCollisionEnter not working with CharacterController 1 Answer
OnCollisionEnter Push Object Problem 0 Answers