Rigidbody2D adding force vs modifying velocity for character jump

Hey Guys,

I know that there is a lot of question of adding force versus velocity changes, but I’m using the Rigidbody2D from 4.3 version and I have a problem in my jump. For example, I give an initial force to my rigidbody, than if the player hold the button, I add like a small up force each 0.1 seconds. My problem is that The jump curve is not perfect because Each time that I add force, I can see that It makes a little peak in the curve. I was like, I could add less force each time, but if I dont add that much force, I don’t see a difference. Then I began investigating modifying velocity directly. I’m still not sure of what is the difference between mRigidyBoddy.AddForce(Vector2.up * 10) and mRigidBody.velocity = mRigidBody.velocity + Vector2.up *10;. If some one could explain the difference clearly that would be great. Also, to fix my jump problem, I saw that in the normal rigidbody class, there was an AddRelativeForce, I don’t know if it is the key to my problem. Does anybody has an idea ?

Thanks a lot for your time and have a good day :slight_smile:

Claude

Given that you have the framework to test, why you don’t try yourself the difference between those two. From the physics point of view force and velocity are different magnitudes and in Unity behave way differently for instance when player is in the max height of jump (his velocity approaching to zero) add force will still make him jump (it will be added regardless his state position velocity) but velocity times 10 will not since his velocity is 0. etc…

If you continue moving player up and down in the gravity system you will always have peaks in the height, because player is actually facing opposite forces continuously(gravity vs your addforce) One thing I have in mind is to turn his rigidbody gravity field off (if it cannot be done just disable rigidbody on him) while you hold the button and after first iteration decrease the velocity or clamp it, well test it I cant say how it will work