333GameStudio

PlayerMove1

Jun 19th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var speedY : float;
  2. var speedZ : float;
  3.  
  4.  
  5. function Update(){
  6. if(Input.GetKey("d")){
  7.  
  8.  
  9. GetComponent.<Rigidbody>().AddForce(Vector3(speedY,0,0));
  10.  
  11.  
  12. }
  13. if(Input.GetKey("a")){
  14.  
  15. GetComponent.<Rigidbody>().AddForce(Vector3(-speedY,0,0));
  16.  
  17. }
  18. }
  19. function OnCollisionStay(col : Collision){
  20. if(Input.GetKeyDown("w")){
  21.  
  22. GetComponent.<Rigidbody>().AddForce(Vector3(0,speedZ,0));
  23.  
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment