Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. using System.Collections;
  2.  
  3. public float speed = 2f;
  4. CharacterController player;
  5.  
  6. float moveFB;
  7. float moveLR;
  8.  
  9. // Use this for initialization
  10. void Start () {
  11.  
  12. player = GetComponent<CharacterController> ();
  13.  
  14. }
  15.  
  16. // Update is called once per frame
  17. void Update () {
  18.  
  19. moveFB = Input.GetAxis ("Vertical") * speed;
  20. moveLR = Input.GetAxis ("Horizontal") * speed;
  21.  
  22. Vector3 movement = new Vector3 (moveLR, moveFB, 0);
  23. movement = transform.rotation * movement;
  24. Player.move (movement * time.deltaTime);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement