- Home /
addforce jump sometimes long,sometimes short
I use below code to make a box(with a rigidbody) jump : rigidbody.AddForce(Vector3.up * FORCE_UP, ForceMode.Impulse);
but some times it jump 1000px,some times only jump 100px, what's wrong?
Answer by MadJohny · Jul 22, 2013 at 03:29 PM
If you aren't try putting it inside of FixedUpdate, and I don't know if this would work since it's for adding force, but you could try rigidbody.AdddForce (Vector3.up FORCE_UP Time.deltaTime, ForceMode.Impulse);
1.Putting it inside of FixedUpdate not work.
2.rigidbody.AdddForce (Vector3.up FORCE_UP Time.deltaTime, Force$$anonymous$$ode.Impulse) : This will make rigidbody not jump,just stay there.
you could try setting the rigidbody velocity ins$$anonymous$$d: js = rigidbody.velocity.y = 10;(adjust it) c# = rigidbody.velocity = new Vector3 (rigidbody.velocity.x,10f,rigidbody.velocity.y);
accept the answer, answer me as a comment, and np :)
Your answer
Follow this Question
Related Questions
Rigid Body Wait 1 Answer
My character double jumps if he runs, before jumping?? 1 Answer
Rigidbody AddForce Up - different value. 1 Answer
Character doesn't fall back down when jumping 0 Answers
AddForce to sphere 1 Answer