Advertisement
Guest User

Untitled

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