- Home /
I can't get my 3d Player to jump uppwards when pressing space...?
so, i was making a 3d obstacle game, and apart from dodging objects, i want to jump over them, but when i press space it just keepss going like nothing... this is what i've done, im really new, so i was expecting this to happen anyways haha.
public class PlayerMovement : MonoBehaviour {
public Rigidbody rigidb;
public float uppwardsForce = 200f;
void Start()
{
if (Input.GetKey("space"))
{
rigidb.AddForce(0, uppwardsForce * Time.deltaTime, 0);
}
}
}
if someone knows about this please tell me.
Comment
Your answer