Created
June 18, 2020 23:23
-
-
Save dinukapj/0025e3e2d5492636d28eb4e6219909a4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public Rigidbody rigidBody; | |
public KeyCode forwardKey = KeyCode.A; | |
public float speed = 20; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
if (Input.GetKeyDown(forwardKey)) | |
{ | |
rigidBody.AddForce(0, 0, speed); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment