Guest User

Untitled

a guest
Oct 15th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. public Rigidbody rb;
  2. public float forwardForce = 2000f;
  3. public float sidewaysForce = 500f;
  4.  
  5. void Start () {
  6.  
  7. }
  8.  
  9. // Update is called once per frame
  10. void FixedUpdate () {
  11. rb.AddForce(0, 0, forwardForce * Time.deltaTime);
  12.  
  13. if (Input.GetKey("d")) {
  14. rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0,);
  15. }
  16. if (Input.GetKey("a")) {
  17. rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0,);
  18. }
  19. }
Add Comment
Please, Sign In to add comment