Forum rules - please read before posting.

Jump animation

edited July 2018 in Technical Q&A
Hi,
When I press space my character can jump but it won't move to the 'jump' animation in my animator, it just continues using the run animation.
The jump bool is set in the player script.
I've also checked, jumping and pausing - the jump animation isn't running in the animator at the time either.
Here's my animator screen:
https://imgur.com/a/qOdpN4Y
Does anyone have any ideas?

Comments

  • Any error messages in the Console?  In what AC/Unity versions?

    Your screenshot isn't showing the transitions that cause your Jump animation to play.  Check that Has Exit time? is not checked.

    What you instead really need to check is whether or not the "Jump" boolean parameter on the left is becoming checked while the player is in mid-air.

    If not, let's see the Player's full Inspector.
  • Hi Chris
    I unticked the exit time and it seems to work now.
    Just one question, I'm trying to change the height at which the player jumps, but the problem is if I change the Jump Speed to large number i.e. 9, then it jumps high but it very slowly descends back to the ground again. But if I leave it low then it hardly jumps at all but very quickly goes back to the ground. I've tried messing with the mass and pulls but it's not making a difference. Do you know how to make it jump high but still fall back to the ground quickly?
  • Is your jump animation overriding the Y position?  Sometimes an animation can affect a character's height changes - have a look inside the Animation tab of the imported model's Inspector.

    Playing with the Mass value should affect things, but you can also tinker with the Drag value, as well as the global Gravity option in Unity's Physics settings.
  • Thanks Chris, messing with the physics settings fixed it. One last thing (for real this time I swear), I assume when you press space the Jump bool is triggered in the animator somehow, is it possible to double press space and for it to trigger a glide bool?
  • Not with standard AC, but you could do it easily enough with a custom script.  There's plenty of examples on the Unity forums on how to check for double-keypresses, and once triggered you can modify your player's animator with:

    AC.KickStarter.player.GetAnimator ().SetBool ("Glide", true);

    To prevent this from occuring outside of gameplay, wrap your code block around the following:

    if (AC.KickStarter.stateHandler.IsInGameplay ())
    {
      // Gameplay-only code here
    }
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.