x


what is the jump axis for if (Input.GetAxis(" ? ")

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");

more ▼

asked Jun 09 '12 at 08:51 PM

thedumbone74 gravatar image

thedumbone74
21 3 5 7

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Jun 09 '12 at 09:05 PM

Berenger gravatar image

Berenger
11k 12 19 53

thanks, GetAxis("Jump") works.

Jun 09 '12 at 09:42 PM thedumbone74
(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Jun 09 '12 at 09:40 PM

Player_1 gravatar image

Player_1
0 2 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3790
x3331
x1952
x335
x224

asked: Jun 09 '12 at 08:51 PM

Seen: 1005 times

Last Updated: Jun 09 '12 at 09:42 PM