Last active
April 29, 2021 19:19
-
-
Save daichi-takezawa/ba5c251f2c79e618d314e946ac7ef77d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool jumpNow; | |
public float jumpPower; //調整必要 例850 | |
private void OnCollisionEnter(Collision other) { | |
if (jumpNow == true) { | |
if (other.gameObject.CompareTag("Ground")) { | |
jumpNow = false; | |
} | |
} | |
} | |
void Jump() { | |
if (jumpNow == true) return; | |
if (Input.GetKeyDown(KeyCode.Space)) { | |
rb.AddForce(transform.up * jumpPower, ForceMode.Impulse); | |
jumpNow = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment