Andy Gilbert Posted September 17, 2013 Share Posted September 17, 2013 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 Quote 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 More sharing options...
Rick Posted September 17, 2013 Share Posted September 17, 2013 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! Quote Link to comment Share on other sites More sharing options...
Andy Gilbert Posted September 17, 2013 Author Share Posted September 17, 2013 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 Quote 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 More sharing options...
Rick Posted September 17, 2013 Share Posted September 17, 2013 Can you show me your exact code with keyhit? It should work. Does KeyDown work? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.