Mimic realistic gravity for player jump C#


Trying to re-create a realistic jump for a rigidbody.

What I have been doing

I have been playing around the Rigidbody2d component, trying combinations between mass, gravity… When the user presses Jump I add an upwards force.

For example : rigidbody2D.AddForce (transform.up * 200f);

I just can’t get a realistic jump, it looks like the character is floating or too heavy… any suggestions or different techniques I can try.

Had it been a regular Rigidbody you would have changed the ForceMode to Impulse, but when using Rigidbody2D it seems that you have to calculate the force yourself.
To get the impulse effect this should work:

Vector2 force = (transform.up * force) / Time.fixedDeltaTime;

Then try fiddling around with the mass of your Rigidbody2D and the force applied to get the right jump height.