I've updated the wiki script to allow for animation. Separate from the Player's "Jump bool", this is a Trigger that will be set at the same time the Player jumps using the script.
Update your script from the wiki, make a new Trigger in your Animator, and enter it's name into the Inspector. You can then create a transition based on this Trigger to activate your Player's jumping animation.
The Trigger name can have any name you choose. It just needs to match the text you enter into the CCJump Inspector's new "Jump Trigger" field. If you create a Trigger named jumpTrigger, enter that into the Inspector as well.
You will need to make sure that your Jump animation can transition back to your Idle animation once the Player is back on the ground.
To do this, create a new Bool parameter named "IsGrounded" in your Animator, and enter the same name into the 'Is Grounded' bool field in your Player's Inspector.
At runtime, that parameter should automatically set itself to True when the Player is on the ground - and False when in the air.
You can then use this to create a Transition from your Jump animation to your Idle animation when it's set to True - so that the Player returns to their Idle animation if they become grounded before their Jump animation has finished.
If you still have an issue, it'll be best to see your Animator and Player Inspector so that we can see your exact situation. If you can upload screenshots to imgur.com, copy/paste the link(s) here and I can see what you're working with.
Comments
Welcome to the community, @Kokakee.
I've updated the wiki script to allow for animation. Separate from the Player's "Jump bool", this is a Trigger that will be set at the same time the Player jumps using the script.
Update your script from the wiki, make a new Trigger in your Animator, and enter it's name into the Inspector. You can then create a transition based on this Trigger to activate your Player's jumping animation.
Hi Chris ..thanks... the animator trigger name would be jumpTrigger?
The Trigger name can have any name you choose. It just needs to match the text you enter into the CCJump Inspector's new "Jump Trigger" field. If you create a Trigger named jumpTrigger, enter that into the Inspector as well.
SetFloat"jumpTrigger:" misiing from the script ... also it trigger twice and player stuck in the air afterwards
SetFloat refers to Float parameters - it's nothing to do with Triggers.
There was, however, a typo. The following line:
should instead read:
Make sure that your Capsule Collider's centre is in the centre of the character - its Centre Y value should be half its Height.
Hi
the trigger in the animator trigger wasnt cleared after the 1st jump... it still play a jump animation after the player lands
You will need to make sure that your Jump animation can transition back to your Idle animation once the Player is back on the ground.
To do this, create a new Bool parameter named "IsGrounded" in your Animator, and enter the same name into the 'Is Grounded' bool field in your Player's Inspector.
At runtime, that parameter should automatically set itself to True when the Player is on the ground - and False when in the air.
You can then use this to create a Transition from your Jump animation to your Idle animation when it's set to True - so that the Player returns to their Idle animation if they become grounded before their Jump animation has finished.
If you still have an issue, it'll be best to see your Animator and Player Inspector so that we can see your exact situation. If you can upload screenshots to imgur.com, copy/paste the link(s) here and I can see what you're working with.