Rigidbody.Addforce is becoming inaccurate. Why?

Hello everyone! So I was beginning to work on my jumping function again and then I noticed…

When ever I jump it allows me to move my character with a Rigidbody.Addforce of 250,but!

It ranges from a small amount to a large amount.
and when I say range I mean, you can solidly tell a difference.

Sometimes when I press the jump button my character will jump high and then other times he’ll jump low. But it doesn’t make any since cause the Force of my JumpForce’s number always remain 250.

I’ve been messing around with my script for about 2 days but now I’m getting the feeling that my script isn’t the problem… Hmm, could it be my RigidBody’s Angular Drag and Linear Drag? Well if this is a clue i’ll post up my RigidBody Set up to be viewed.

RigidBody 2D

  • Mass: 5
  • Linear Drag: 10
  • Angular Drag: 10
  • Gravity Scale: 5
  • Fixed Angle (Checked)
  • Is Kinematic (Unchecked)
  • Interpolate (None)
  • Sleeping Mode (Start Awake)
  • Collision Detection (Discrete)

I’m using a 2D character btw!

Any help would be great!

Hi Xeong-Hu

It could be the way you initiate the “AddForce”. I made a lock picking scene and used add force to push the Lockpick up, however it varied on the force applied, depending on how long the “A” key was pressed.

See here: www.vandrice.co.uk/Games/Lockpicking.html

I fixed it by making the script register when the button was pressed, add the force, wait for 1 second and continue.

Hope this helps

Nvm I totally figured it out. Sorry if it was a little difficult to figure out because of my lack of info. But I finally realized that my game was lagging because of my CPU Usage. Then I checked out Fixed Update and Update to see the differences. I Learned that fixed update was better for Rigidbody forces or changes. or anything that involves the rigidbody. So yes. It wasn’t the Rigidbody Force it was just my Update Function.

Posted if anyone else comes across this.