Advertisement
LittleAngel

Untitled

Apr 24th, 2012
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. //cmd + ' / ctrl + ' Input Rigidbody
  2.  
  3. public float speed = 1.0f;
  4. private int collectionCount = 0;
  5.  
  6. void FixedUpdate()
  7. {
  8. if (Input.GetKey(KeyCode.W)) rigidbody.AddForce(Vector3.forward * speed * Time.deltaTime);
  9. if (Input.GetKey(KeyCode.S)) rigidbody.AddForce(-Vector3.forward * speed * Time.deltaTime);
  10. if (Input.GetKey(KeyCode.A)) rigidbody.AddForce(-Vector3.right * speed * Time.deltaTime);
  11. if (Input.GetKey(KeyCode.D)) rigidbody.AddForce(Vector3.forward * speed * Time.deltaTime);
  12. }
  13.  
  14. void OnTriggerEnter(Collider other)
  15. {
  16. if (other.gameObject.tag == "PickUp")
  17. {
  18. other.gameObject.active = false;
  19. collectionCount += 1;
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement