Advertisement
saunter

playercontroller

Oct 24th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class PlayerController : MonoBehaviour
  5. {
  6.     public float speed;
  7.     void FixedUpdate ()
  8.     {
  9.             float moveHorizontal = Input.GetAxis("Horizontal");
  10.             float moveVertival = Input.GetAxis("Vertical");
  11.  
  12.             Vector3 movement = new Vector3(moveHorizontal,0.0f, moveVertival);
  13.  
  14.             rigidbody.AddForce(movement * speed * Time.deltaTime);
  15.     }
  16.     void OnTriggerEnter(Collider other);       
  17.     {
  18.         if(other.gameObject == "pickup");
  19.         {
  20.             other.gameObject.SetActive(false);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement