Answers for "how to make an object jump in unity"

C#
0

how to make an object jump in unity

Rigidbody rb;
float force = 10f;

void Awake(){
  rb = GetComponent<Rigidbody>();
}

void Update(){
   if(Input.GetKeyDown(KeyCode.Space)) {
      rb.AddForce(Vector3.up * force, ForceMode.Impulse);
   }
}
Posted by: Guest on June-03-2021

Code answers related to "how to make an object jump in unity"

C# Answers by Framework

Browse Popular Code Answers by Language