After my “going prone” animation plays. My player spins wildly, do I have to make some sort of Idol animation to play after? If so how do I do this? And also, do you know how to make it so if I press Q once again, the player gets back up into walking position.
Thanks, I’m REALLY stumped here and unity answers is down.
Here is the code
if (Input.GetKeyDown ("q"))
{
animation.Play("prone");
}
you would need a prone idle animation, also if you wanted to see if pressing q again would make the player stand back up you could set up a boolean variable to check if the player is prone already if so stand back up something like this:
//have not tested this, and you shouldn't use it.. This was just to give you an idea
if (Input.GetKeyDown ("q")) {
if(!prone){
animation.Play("prone");
prone = true;
}else{
animation.Play("Stand");
prone = false;
}
}
as for your animation code for the idle I dont feel like going into that but you need to code the animations into your movement code so when u press forward(w key) the play runs and the run animation is played when you release the button the player is in idle mode… same would go for prone
Input.GetKeyDown(“q”) only returns true when the key is pressed, not while it is being held, and not when it is released. There is no count to it. What King’s code does is toggles between the 2 animations each time the q is pressed.