Skip to content

Instantly share code, notes, and snippets.

@dinukapj
Created June 18, 2020 23:23
Show Gist options
  • Save dinukapj/0025e3e2d5492636d28eb4e6219909a4 to your computer and use it in GitHub Desktop.
Save dinukapj/0025e3e2d5492636d28eb4e6219909a4 to your computer and use it in GitHub Desktop.
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