Advertisement
kasru

RTS Style Camera movement

Jan 22nd, 2013
7,875
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //****** Donations are greatly appreciated.  ******
  2. //****** You can donate directly to Jesse through paypal at  https://www.paypal.me/JEtzler   ******
  3.  
  4. var CamSpeed = 1.00;
  5. var GUIsize = 25;
  6.  
  7. function Update () {
  8. var recdown = Rect (0, 0, Screen.width, GUIsize);
  9. var recup = Rect (0, Screen.height-GUIsize, Screen.width, GUIsize);
  10. var recleft = Rect (0, 0, GUIsize, Screen.height);
  11. var recright = Rect (Screen.width-GUIsize, 0, GUIsize, Screen.height);
  12.  
  13.     if (recdown.Contains(Input.mousePosition))
  14.         transform.Translate(0, 0, -CamSpeed, Space.World);
  15.  
  16.     if (recup.Contains(Input.mousePosition))
  17.         transform.Translate(0, 0, CamSpeed, Space.World);
  18.  
  19.     if (recleft.Contains(Input.mousePosition))
  20.         transform.Translate(-CamSpeed, 0, 0, Space.World);
  21.  
  22.     if (recright.Contains(Input.mousePosition))
  23.         transform.Translate(CamSpeed, 0, 0, Space.World);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement