Advertisement
EdibleCookie

PlayerController

Apr 17th, 2018
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. // PlayerController Script for player and AI.
  2.  
  3.  
  4. using UnityEngine;
  5. public class PlayerController : MonoBehaviour
  6. {
  7.     public float speed = 1.0f;
  8.  
  9.  
  10.     void Update()
  11.     {
  12.  
  13.         var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
  14.         var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;
  15.  
  16.         transform.Rotate(0, x, 0);
  17.         transform.Translate(0, 0, z);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement