hi,
can´t I apply force with this input command?
function FixedUpdate () {
if (Input.GetKeyDown (KeyCode.Space)){
rigidbody.AddRelativeForce (0,10,0);
}
}
hi,
can´t I apply force with this input command?
function FixedUpdate () {
if (Input.GetKeyDown (KeyCode.Space)){
rigidbody.AddRelativeForce (0,10,0);
}
}
Can’t see why not… Although, you want to check for input at Update() and not FixedUpdate().
Just add some Debug.Log there to see what’s going on. Should work just fine.
this does not work
what is the correct way to use input with
rigidbody?
in or out of FixedUpdate()?
Well, one thing I notice is that since you’re using GetKeyDown it will only apply the force for the frame when you first press down the key. Since it’s a relatively small force you’re applying, it might just not be moving enough to notice.
++ to this. Just throw in a Debug.Log(“Button pressed!”); inside the if statement to see if it’s firing at all.
This i script worked fine for me but he’s right. i jacked up the vector to around 1000 then you really notice it. Add gravity to the rigid body and makes for a nice simple jump script