Answer the question
In order to leave comments, you need to log in
How to make a jump that is independent of the current speed?
I decided to make a clone of Doodle jump and ran into a problem that the player sometimes (rarely, but an eyesore) jumps "half a ball" (not completely, but about half). How can I replace AddForce for my task? Or is it the norm?
Here is the code:
public void Jump()
{
_rigitbody.AddForce(Vector2.up * _jumpForce, ForceMode2D.Impulse);
}
Answer the question
In order to leave comments, you need to log in
_rigitbody.AddForce
adds another vector of force applied to the object. The final movement occurs under the resultant forces.
In other words, when you throw on Vector2.up * _jumpForce
the resultant force will not only be directed upwards if another force was added somewhere on the body. Those. According to your description, everything looks like that somewhere on the body there is a downward force of gravity, which is approximately equal to the force that you are trying to lift up. And because he does not move at all or barely moves
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question