|
Hi, I am attempting to make a rigid body jump upwards (global) The script which i have tried to use doesn't seem to work. All help is appreciated.
(comments are locked)
|
|
First off, put that in FixedUpdate. Otherwise, try using this- It's possible that you just aren't seeing anything because the force is too low!
(comments are locked)
|
|
The easiest way is to set the rigidbody.velocity directly (you will not depend on the object mass): According to the docs you should not directly modify the velocity of a rigidbody as it creates weird results and unrealistic behaviour.
Jan 27 at 04:45 PM
Vincent P
Yes: in this particular case, the unrealistic behaviour will be the rigidbody stopping its horizontal movement and jumping vertically. Actually, you can modify rigidbody.velocity directly without screwing up the physics as long as the current velocity is taken into account - that's what AddForce and other rigidbody functions do. This would preserve the current movement and simply add a vertical component.
Jan 28 at 12:25 PM
aldonaletto
No I was more talking about the fact that if you just add velocity to rigidbody, you are not "pushing" it up. So what happens is that gravity starts to compund and as soon as you stop applying the velocity, the object will shoot down. Don't get me wrong, it'll still works. Just commenting in case any one else runs into the issue.
Jan 30 at 05:23 AM
Vincent P
(comments are locked)
|
