Advertisement
Eriknem

Untitled

Oct 20th, 2016
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | None | 0 0
  1. private Rigidbody rb;
  2.  
  3.     // Use this for initialization
  4.     void Start () {
  5.         rb = GetComponent<Rigidbody>();
  6.     }
  7.    
  8.     // Update is called once per frame
  9.     void FixedUpdate () {
  10.         float moveHorizontal = Input.GetAxis ("Horizontal");
  11.         float moveVertical = Input.GetAxis ("Vertical");
  12.  
  13.         Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
  14.  
  15.         rb.AddForce (movement);
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement