Advertisement
LittleAngel

OverGUI

Oct 19th, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1.  
  2. void Update () {
  3.  
  4. // if (Input.GetMouseButton(0) && sliderRect.Contains (Input.mousePosition)) {
  5. // Debug.Log ("Over GUI");
  6. // } else {
  7. // Debug.Log ("NOT Over GUI");
  8.  
  9. if (Input.GetMouseButtonDown(0)) {
  10. previousMousePos = Input.mousePosition;
  11. } else {
  12. deltaPos = Vector3.zero;
  13. }
  14.  
  15. if (Input.GetMouseButton(0)) {
  16. deltaPos = Input.mousePosition - previousMousePos;
  17. previousMousePos = Input.mousePosition;
  18. Vector3 newRotation = Vector3.zero;
  19. newRotation.x = -deltaPos.y * sensitivity;
  20. newRotation.y = -deltaPos.x * sensitivity;
  21. thisTransform.Rotate (newRotation, Space.World);
  22. }
  23. // }
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement