Skip to content

Jerky Animation when player's character is falling down. #1

@gubatron

Description

@gubatron

So I've done a few things, but I think the issue now has to do with the configuration of the sprite animation itself.

I first checked the Player's Animator graph
Screen Shot 2020-10-22 at 8 53 07 PM

Then I clicked on the Transition Property on the right side
Screen Shot 2020-10-22 at 8 54 15 PM

First there is a bug with the Condition, the player is not falling if it's grounded.

Screen Shot 2020-10-22 at 8 55 35 PM

I saw that the condition "IsGrounded", is defined in the Animator > Parameters tab on the upper left
Screen Shot 2020-10-22 at 8 56 54 PM

Then I looked for C# code that had something to do with the player, and I found under

Project > Assets > Scripts > PlayerController.cs

I opened up the file and I noticed there is an Animator object called animator
Screen Shot 2020-10-22 at 8 58 47 PM

then I saw that this is how Csharp code talks to the Animator, by setting the parameters we saw above:
Screen Shot 2020-10-22 at 8 59 30 PM

I decided to create a new parameter IsFalling, which is set when the velocity of the player is negative.
I confirmed this is True using Debug.Log("Velocity Y: " + _rigidbody.velocity.y) and playing the game, it would show negative Y velocity when falling on the Console.

So, I created a new Parameter IsFalling in Unity for the player Animator
Screen Shot 2020-10-22 at 9 02 24 PM

Screen Shot 2020-10-22 at 9 02 28 PM

I fixed the condition on the transition of the animator:
Screen Shot 2020-10-22 at 9 03 38 PM

And then I set that property in C# to be true or false depending on the Y speed, and if the player isn't grounded.
Screen Shot 2020-10-22 at 9 05 53 PM

This did not solve the problem, the loop on the animation stays the same when falling, BUT, something weird happens.
When the character is on the ground, now it looks the way it's supposed to look when it's falling. Even when you move it, it stays that way. So I must be getting close.

Screen Shot 2020-10-22 at 9 16 31 PM

Screen Shot 2020-10-22 at 9 16 39 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions