CharacterController Jump

Hi all,

If my GameObject which uses the CharacterController collides with a powerup I want the player to automatically jump higher than the default jump. Normally I would use rigidbody.AddForce or rigidbody.velocity.y … etc but how would I do this with the character controller?

Thanks

Jeff

Try this, where maxJump is affected by the “PowerUp”

public int maxJump = 5;

void Update()
{
        CharacterController cc = this.GetComponent<CharacterController>();

        if (Input.GetAxis("Vertical") > 0)
        {
            cc.Move(Vector3.up * maxJump);
        }

}

void OnControllerColliderHit(ControllerColliderHit hit)
{
        if(hit.gameobject.name == "jumpPowerUP") maxJump = 10;
}