Glider physics with AddForce 2D

Hello!
I am making a game where the player is using a “glider” in 2D space to fly, i would like to achieve the effect of “gaining speed” when rotating downwards, and then when rotating upwards you would reach a max speed and then start tilting down again, and loose speed over time so that you would eventually stop completely.

Here is a picture to make it more clear:
36660-idea.png

I dont know alot about coding but this is what i tried so far:

public float flightSpeed = 25.0f;

void FixedUpdate () {
	
	rigidbody.AddForce(Vector3.forward * flightSpeed);
}

I also use a script to rotate the character, and it does go in the right direction its facing, but it keeps going forever, and doesn’t loose speed when going upwards.

(The game is in 2d space but the character is a 3d model)

Any tips on how i could achieve this effect? :slight_smile:

Check out the Vector3.Dot function. if you use it with your Vector3.forward and Vector3.up, you should get 0 when horizontal, negative values when the nose is pointing down and positive ones when pointing up. Subtract a multiple of that value from the applied force (or add when using Vector3.down) and you should get something like you want.