Advertisement
MrsMcLead

Untitled

Nov 8th, 2013
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Movement : MonoBehaviour {
  5.        
  6.     //remember to change the speed in Unity!
  7.     public float speed = 0.0f;
  8.              
  9.         // Update is called once per frame
  10.         void Update () {
  11.                
  12.         //variables for location
  13.         float x = Input.GetAxis("Horizontal");
  14.                 float y = Input.GetAxis("Vertical");
  15.         float z = Input.GetAxis("Mouse ScrollWheel");
  16.  
  17.         //change the value of the location                
  18.         x = x*Time.deltaTime*speed;
  19.                 y = y*Time.deltaTime*speed;
  20.         z = z*Time.deltaTime*speed*25;
  21.        
  22.                
  23.         //change the actual location
  24.         transform.Translate(x,y,z);
  25.            
  26.                
  27.         }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement