Help with Jumping and Landing

Hi, I am going through the course for the second time, but tyring to do as much as I can without refering to the videos, just my notes. To check to see how much I have retained :smiley:

I am only implementing locomotion and jumping for the time being. As you can see from the video, the jump and landing looks good for the first time. But I do not go back into showing the running animation. And subsequent jumps sometimes do not fire off , or they only show landing animation. or they very small jumps. I have tried to look at code and it seems ok to me… I have added a landing state as am using different animations.

Any help much appreciated

Thanks



Rather looks like a bit of a temper tantrum, doesn’t it?

First thing, I would put some Debug.Logs in the Enter/Exit states to make sure you’re properly transitioning…
The next thing to check is the velocity in the ForceReceiver… Make sure that the vertical velocity is being updated correctly… If grounded, it should just be gravity * time.deltatime, if not grounded, then lower it by that:

        if (verticalVelocity < 0f && controller.isGrounded)
        {
            verticalVelocity = Physics.gravity.y * Time.deltaTime;
        }
        else
        {
            verticalVelocity += Physics.gravity.y * Time.deltaTime;
        }

This still doesn’t account for why FreelookState isn’t working after the jump, though…

This topic was automatically closed after 20 days. New replies are no longer allowed.

Privacy & Terms