Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Rigidbody rb;
- public float forwardForce = 2000f;
- public float sidewaysForce = 500f;
- void Start () {
- }
- // Update is called once per frame
- void FixedUpdate () {
- rb.AddForce(0, 0, forwardForce * Time.deltaTime);
- if (Input.GetKey("d")) {
- rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0,);
- }
- if (Input.GetKey("a")) {
- rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0,);
- }
- }
Add Comment
Please, Sign In to add comment