Apparently this is the new AddForce thing
Public float jumpSpeed = 5f;//or whatever you want it to be
public Rigidbody rb; //and again, whatever you want to call it
void Start (){
rb = GetComponent ();
}
Void FixedUpdate(){
if(Input.GetKey (KeyCode.Space)){
rb.AddForce(Vector3.up * jumpSpeed);
}
}
and in the inspector just drag the Player game object from the hierarchy to the rb slot in the script and you're good :3
↧