S
S
Surface-ketch2016-04-04 19:00:46
Programming
Surface-ketch, 2016-04-04 19:00:46

How to make jump force equal in unity?

By clicking the mouse, the object bounces, the number of jumps is not limited, that is, jumps can be made in the air. If you use addforce, then with each subsequent jump, the force increases many times over and the object simply flies into "space". How to make all jumps the same?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis Gaydak, 2016-04-04
@Surface-ketch

docs.unity3d.com/ScriptReference/Rigidbody.AddForc...
There is a parameter - the type of force applied, as I understand it, you need docs.unity3d.com/ScriptReference/ForceMode.Impulse.html
Impulse. single use of force. kinda kick in the ass)

D
Deerenaros, 2016-04-07
@Deerenaros

GetComponent<Rigidbody>().velocity += new Vector(0, jumpPower); // зависит от оси, по которой прыгаем

However, when using AddForce, essentially the same thing happens, only it is divided by mass (Newton's second law). Therefore, the problem is rather in endless jumps. You can take a short timeout per jump to limit the growth rate.

S
Surface-ketch, 2016-04-04
@Surface-ketch

It's decided.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question