Created
May 7, 2022 03:42
-
-
Save cyberjj999/798a83d65c457ff61178a18dadec036a to your computer and use it in GitHub Desktop.
Becoming A Metaverse Developer Article | Update() Method
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
// Update is called once per frame | |
void Update() | |
{ | |
// If user press Space and is on the ground | |
if (Input.GetKeyDown(KeyCode.Space) && IsGrounded()) | |
{ | |
// Jump is set to true | |
toJump = true; | |
} | |
// Get horizontal and vertical inputs from user | |
// (horizontal input are 'A' and 'D' keys, or left/right arrow keys) | |
// (vertical input are 'W' and 'S' keys, or up/down arrow keys) | |
horizontalInput = Input.GetAxis("Horizontal"); | |
verticalInput = Input.GetAxis("Vertical"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment