x


double jump problem

im using the y velocity of my rigidbody to perform a double jump action. The problem is that when i press the jump button for the 2nd time on the highest point for the first jump i expect the y velocity to be higher. But it works the complete opposite, the y velocity goes down. And when i press the jump button for the 2nd time before it reaches its highest point the y velocity goes up and it jumps really high???

1st jump:

if( jumpCount == 0 )
 {
 jumpCount ++;
 playerTransform.rigidbody.velocity.y = 16;
 }

2nd jump:

 else if( jumpCount == 1 )
 {
 playerTransform.rigidbody.velocity.y += 5 ;
 jumpCount ++;
 }
more ▼

asked Jul 10 '12 at 09:59 AM

samz gravatar image

samz
46 13 28 36

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

1 answer: sort voted first

I am new to Unity but if velocity works like I think it should, you should probably just be setting .y to 16 again as outside forces likely work upon the velocity.

more ▼

answered Jul 10 '12 at 10:13 AM

RevenantBob gravatar image

RevenantBob
36

thnx that worked...oddly enough :S

Jul 10 '12 at 10:40 AM samz
(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:

x335

asked: Jul 10 '12 at 09:59 AM

Seen: 263 times

Last Updated: Jul 10 '12 at 10:40 AM