- Home /
parabolic jump
I am new to programming I tried many code and it is not working help will be great.when space bar key is released by player the player should jump in parabolic jump and the distance of the jump should be based on the how long player kept space bar button down parabolic jump should happen after player release the space bar and distance of jump should depend on how long player kept space bar down player should be able to press space bar only after player land on ground after parabolic jump I have asked this question like an essay please ignore and please help since I am new to unity all help will great to me
In Unity there are three primary methods of moving an object: Rigidbody, Character Controller, direct manipulation of the tranfrom. Whoever answers this question needs to know how you are going to move your character, since answer is different depending on the movement method.
I want to move the player either using character controll or rigid body since I want collision also work along with movement
I think you need to do some research and be more specific with your question. The challenges of solving this problem for a character controller are different than solving them for a rigidbody. You need to consider other details, like do you want to get the distance by staying in the air longer, or jumping forward faster, or both. Let me give you a few things to consider and research:
In order to lock out jumping while in the air, you need some mechanism to detect if you are grounded. This comes for 'free' using a character controller, but you have to code it yourself for a rigidbody. There are lots of posts on detecting ground for a rigidbody.
You can deter$$anonymous$$e how long a key is pressed by recording Time.time on Input.Get$$anonymous$$eyDown() and subtracting it from Time.time on Input.Get$$anonymous$$eyUp().
Gravity is done for you when using a Rigidbody, but may have to implement gravity yourself for a character controller. See CharacterController.Simple$$anonymous$$ove() and CharacterController.$$anonymous$$ove(). Both have example scripts the one for $$anonymous$$ove() includes the implementation of gravity.
"Normal" jumps are parabolas. In other words, if you figure out how to set the starting up speed and forward speed, and apply gravity correctly as you move (or use a rigidbody and let Unity do the work,) you will get a proper parabolic jump.
Answer by Seizure · Oct 02, 2013 at 05:03 PM
Heres an example of a a ball jumping over an obstacle by pressing space.Space to jump
Your answer
Follow this Question
Related Questions
How do I lock Y Axis movement for Parented Camera? 3 Answers
making a jump button 2 Answers
Query on UnityScript Editor Features 1 Answer
How do I fix my player jumping code? 2 Answers
Move forward and jump using touchpad 0 Answers