Advertisement
D8ms

Untitled

Feb 3rd, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2.  
  3. public class MovementScript : MonoBehaviour {
  4.     public float moveSpeed = 50;
  5.                
  6.     public void FixedUpdate() {
  7.         MaybeMove();
  8.        }
  9.  
  10.     public void MaybeMove(){
  11.         Vector3 moveDir = (Input.GetAxisRaw("Horizontal") * Vector3.right) + (Input.GetAxisRaw("Vertical") * Vector3.forward);
  12.         transform.Translate(moveDir.normalized * moveSpeed * Time.deltaTime);
  13.        }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement