Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2018
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class _objRot : MonoBehaviour
  6. {
  7. float rotSpeed = 125;
  8.  
  9. // Use this for initialization
  10. void Start()
  11. {
  12.  
  13. }
  14.  
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. }
  19.  
  20. void OnMouseDrag()
  21. {
  22. float rotX = Input.GetAxis("Mouse X") * rotSpeed * Mathf.Deg2Rad;
  23. float rotY = Input.GetAxis("Mouse Y") * rotSpeed * Mathf.Deg2Rad;
  24.  
  25. transform.Rotate(Vector3.up, -rotX, Space.World);
  26. transform.Rotate(Vector3.right, rotY, Space.World);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement