- Home /
third person double jump
hey guys , i want a double jump to this script , i removed if (IsGrounded()) for unilimited jumps , but me all i want is just 2 jumps , how could i modify this script please , btw im using the default third person character controller from unity , thanks !
function ApplyJumping ()
{
// Prevent jumping too fast after each other
if (lastJumpTime + jumpRepeatTime > Time.time)
return;
if (IsGrounded()) {
// Jump
// - Only when pressing the button down
// - With a timeout so you can press the button slightly before landing
if (canJump && Time.time < lastJumpButtonTime + jumpTimeout) {
verticalSpeed = CalculateJumpVerticalSpeed (jumpHeight);
SendMessage("DidJump", SendMessageOptions.DontRequireReceiver);
}
}
}
Answer by KazeEnji · May 01, 2013 at 05:22 PM
You could add a double jump boolean variable. Set it to false if grounded, true if in the air then one last calculation where if they jump again in the air, set the boolean back to false.
You could also just have an integer counter. Something that looks for the number of jumps performed and caps it at two then resets when the player touches the ground again.
dude please can u edit it for me im a quit noob a coding please help , here's the whole script : http://sharetext.org/6i9Z
Your answer
Follow this Question
Related Questions
third person double jump 0 Answers
double jump script 0 Answers
Best practice for properties "get{} set{}" ? 2 Answers
My double jump script is not working 1 Answer
Joints Configured from Script do not work properly? $20 reward 3 Answers