- Home /
Jump animation anticipation
my jump animation has an anticipation that the character bends down to jump.
only that he is on high already when this part of the animation comes, there is some way the jump comes out in a specific frame or make an animation of him getting ready, which is mandatory before he jumps
I've tried some more ways so far without success
my animation has 28 frames and 9 are anticipation, so I wanted to make it jump from frame 10
my codes:
PlayerController-
private void FixedUpdate()
{
rb.velocity = newMovement;
if (jump)
{
jump = false;
rb.velocity = Vector2.zero;
rb.AddForce(Vector2.up * jumpForce);
}
}
public void Jump()
{
if (grounded)
{
jump = true;
playerAnimations.SetJumping(jump);
}
player animation
public void SetJumping(bool jump)
{
anim.SetBool("Jump", jump);
}
Player input
if (Input.GetButtonDown("Jump"))
{
playerController.Jump();
}
help me please!
Answer by Marioooo · Oct 28, 2019 at 03:51 AM
There's several ways you can solve this problems, one is use a timer in code...
When you hit space, start the animation and start a timer variable and on update check when the time has accomplished... Then add the force to jump...
Other solution is to add a animation event...
I've never done such thing so you have to Google it... Basically you call a function when an animation has reached some frame you set... You can call a function that adds force to player's rigidbody
Good luck!
Answer by melvincostner · Oct 28, 2019 at 12:43 PM
Thanks I used a Jump () function in a specific frame, and put pro if (input ...) to play the animation.
Your answer
Follow this Question
Related Questions
Make Animation Play After Boolean is Set to True? 2 Answers
Error console animator 0 Answers
Blend Tree Transition Conditions. 0 Answers
Air jumping animation help 1 Answer
why will my jump animation only play on multi-jumps? 0 Answers