which axis do i use to play my “jump animation” if i wanted to use this line of script ?
if (Input.GetAxis(" ? ") > 0)
animation.Play (“jump”);
which axis do i use to play my “jump animation” if i wanted to use this line of script ?
if (Input.GetAxis(" ? ") > 0)
animation.Play (“jump”);
Whichever you want sounds like a good answer. You may have seen Input.GetAxis(“jump”) ins some tutorial, hence the confusion. GetAxis take a string depending on the Input Manager. By default, Unity defines a “jump” for the space bar, because it’s often what you want, but feel free to either modify “jump” in the IM, or create your own.
well all the GetAxis is i detecting the key press so you need something like
void Jump()
{
if(Input.GetAxis(“Space”) > 0) {
animation.Play(“walk”);
rigidbody.AddForce(Vector3.up *JumpSpeed);
}
}
try seting your jump speed to something depending on the scale of your game