📜  如何使对象统一跳转 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:12.802000             🧑  作者: Mango

代码示例1
Rigidbody rb;
float force = 10f;

void Awake(){
  rb = GetComponent();
}

void Update(){
   if(Input.GetKeyDown(KeyCode.Space)) {
      rb.AddForce(Vector3.up * force, ForceMode.Impulse);
   }
}