Jump to content

Jumping Toggle?


Andy Gilbert
 Share

Recommended Posts

Seeing as i cant get KeyHit to work, im trying to use the jump function in SetInput and what im finding is, simply having KeyDown setting the jump value makes my character act like he has a jetpack on his back, just keeps going up.

 

So how do i detect when the key has been released in order to reset the jump? I want to make it so you have to press to jump, not continue jumping with it down.

 

Ive tryed raycasting downwards, but not had much luck? Plus this the character will continue jumping when the pick is detected, so if i hold my key down he just keeps bobbing up and down like hes in invisible water?

 

Whats the solution? Im sure im just not getting it....

 

Ta, Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

Reset a jump variable to 0 at the start of each update no matter what. Then below that check for keyhit on spacebar AND if not airborne, then set the jump variable to a number > 0.

 

 

just an example, doesn't work as I don't recall exact syntax

jump = 0

if(KeyHit(KEY_SPACE) AND not controller->Airborne())
jump = 10


controller->SetInput(move, strafe, jump);

 

 

Setting the jump variable in 1 frame will launch the controller upward and then gravity will take over. As you've notice if you set the jump variable > 0 on each frame your controller just keeps going up up up!

Link to comment
Share on other sites

Hi Rick, for some reason KeyHit just dosnt seem to work? Can you or anyone try keyhit and check, as with me nothing happenes. Ive alsoreported this before.

 

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...