1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class WindowGenSui : MonoSingleton<WindowGenSui>
- {
- public float jd = 30;
- // Update is called once per frame
- void Update()
- {
- this.transform.position = OpenXRCamera.Instance.head.position;
- float f = Mathf.Abs(this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y) - jd;
- if (this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y >= jd&& this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y < jd+180)
- {
- if (Mathf.Abs(this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y) > 180)
- {
- transform.RotateAround(Vector3.zero, Vector3.up,f);
- }
- else
- {
- transform.RotateAround(Vector3.zero, Vector3.up, -f);
- }
- }
- else if (this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y < -jd && this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y > -jd - 180)
- {
- if (Mathf.Abs(this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y) > 180)
- {
- transform.RotateAround(Vector3.zero, Vector3.up, -f);
- }
- else
- {
- transform.RotateAround(Vector3.zero, Vector3.up,f);
- }
- }
- else if (360 -(this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y) >= jd && 360 - (this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y) < 180)
- {
- transform.RotateAround(Vector3.zero, Vector3.up, -jd - 360 - (this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y));
- }
- else if(360 + (this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y) >= jd && 360 + (this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y)<180)
- {
- transform.RotateAround(Vector3.zero, Vector3.up, jd - (360 + (this.transform.eulerAngles.y - OpenXRCamera.Instance.head.eulerAngles.y)));
- }
- }
- }
|