Rigidbody rb;
float force = 10f;
void Awake(){
rb = GetComponent<Rigidbody>();
}
void Update(){
if(Input.GetKeyDown(KeyCode.Space)) {
rb.AddForce(Vector3.up * force, ForceMode.Impulse);
}
}
Rigidbody.AddForce(Vector3 force);Copy
Rigidbody.AddForce(Vector3 force);Copied!