Adding an upward force

I’m trying to add an upward force on my character to give a gliding feel when he is in midair, but it doesn’t seem to work.

Here is the related code:

if (Input.GetButton ("Fire1")) {   
                    rigidbody.AddForce (0,10,0);

There is a rigidbody attached to the object. The scene is just a simple cube as character and plane as floor so nothing else should be interfering with it.

I also tried adding a constant force component which didn’t work either

If anyone could help would be greatly appreciated

If pushing doesn’t work, push harder. That’s my philosophy.

However, you could disable it’s gravity as well.

Are you manually modifying the velocity ? That would cancel the AddForce. Also, the debug line gets printed right ?

Hey there, moving comment to answer so people can see what was wrong:

The problem was that while Fire1 was pressed, moveDirection.y is still being minuses. Therefore the glide and vertical position modifiers were cancelling each other out. Try this:

if (Input.GetButton ("Fire1")) { 
    rigidbody.AddForce (0,100,0);
} else {
    moveDirection.y -= gravity * Time.deltaTime;

Thanks also to @Berenger for help!