2d add force inconsistency
I am making a 2D platformer game, and I have decided to make my Character prefab from scratch. I have most of my animations and my maneuvering worked out, but one thing that I cannot figure out how to fix is the jumping. I use a Rigidbody2D.addForce(Vector2.up*jumpHeight) function and it works well most of the time, but sometimes, when my character jumps, he shoots upwards more quickly and farther than he is supposed to. Is addForce not the best way to work out jumping, or am I doing something wrong with how I am tackling the addForce function.
Thanks Here is my code for jumping:
If (Input.GetButtonDown("Vertical")) {
GetComponent<Rigidbody2D> ().AddForce (new Vector2(0f, jumpHeight*5));
}
Your answer
Follow this Question
Related Questions
How to add force based on surrounding colliders in 2D? 0 Answers
Using AddForce for horizontal movement doesn't quite work the way I want it to (2D) 1 Answer
why does my 2d platformer lags? 1 Answer
How can I create random butterfly flying over a random 2d path. 0 Answers
FixedUpdate or Update for collision detection and climbing slopes? 1 Answer