Advertisement
Guest User

Untitled

a guest
Dec 9th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class CameraMovementScriptOrbit : MonoBehaviour
  6. {
  7.  
  8. public Slider cameraSlider;
  9.  
  10. public GameObject obj;
  11.  
  12. Vector3 cameraRotation;
  13. float sliderValueInEuler;
  14. float sliderValueSave;
  15.  
  16. float temp;
  17. float rotation;
  18.  
  19. void Start()
  20. {
  21. temp = cameraSlider.value;
  22. cameraSlider.onValueChanged.AddListener(delegate { ValueChangeCheck(); });
  23. }
  24.  
  25. public void ValueChangeCheck()
  26. {
  27. rotation = -temp + cameraSlider.value;
  28. this.transform.RotateAround(obj.transform.position, Vector3.up, rotation);
  29. temp = cameraSlider.value;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement