Is there any way to do a double jump with the first person controller?

Hey, I’m working on a platformer game and I’m re-working the first person controller for the player character. Everything has been fine so far, but I need to make the character be able to jump in midair. I think the changes I need to make are somewhere in the character motor script, but I’m not 100% certain. Any help is very much appreciated.

I also found a Unity Package that some guy made back in 2010 that was a modified version of the first person controller to make it function more like the Unreal Tournament 3 player character, which would allow for double jumping. Unfortunately, all of the scripts were missing when I imported it, so I’m not sure if I’m doing something wrong, or if the package is corrupted. If anyone knows a solution to that, I’d also appreciate it.

You just have to remember if the character has already jumped midair:

public int airJumps = 1;
private int jumpCounter = 0;
//you could use a simple boolean instead, but
//like this you can do a triple, quadruple, etc jump

private bool isGrounded; 
//The character controller script probably has this already
//Is true iff the character touches the ground

//inside Update:
if(isGrounded){
    jumpCounter = 0;
}
if( Input.GetButton ("Jump") ){   //Lokate this in the script. It's probably already there in some form.
    if(isGrounded){
        Jump();
    } else {
        if(jumpCounter  < airJumps){
            jumpCounter++;
            Jump();
        }
    }

}

sorry I’m writing this from my wiiU so I can’t look at the controller script right now. Try this:

var jump : float = 9.0;
var dJump : float = 5.0;
var gravity : float = 20.0;
private var canDJump : boolean = false;
private var velocity : Vector3 = Vector3.zero;
var controller : CharacterController;
 
function Update() 
{
    if (!controller.isGrounded && canDJump && Input.GetButtonDown ("Jump"))
    {
        velocity.y = dJump;
        canDJump = false;
    }
 
    if (controller.isGrounded)
    {
        if (Input.GetButtonDown ("Jump"))
        {
            velocity.y = jump;
            canDJump = true;
        }
    }
    velocity.y -= gravity * Time.deltaTime;
    controller.Move (velocity * Time.deltaTime);
}