API_SwitchMode.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using SC.XR.Unity.Module_InputSystem.InputDeviceGC.KS;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class API_SwitchMode
  6. {
  7. InputDeviceKSPart kspart;
  8. InputDeviceKS ks;
  9. public float _modelPosOffset = 0.15f;
  10. public float _delayOffset =0.3f;
  11. public void API_Set_Offset(float _modelPos,float _delay)
  12. {
  13. _modelPosOffset = _modelPos;
  14. _delayOffset = _delay;
  15. }
  16. public void API_GSXR_Set_TrackingMode(bool is6dof)
  17. {
  18. API_GSXR_Slam.plugin.GSXR_Set_6Dof(is6dof);
  19. ks = API_GSXR_Module_InputSystem_KS.GSXR_KSDevice;
  20. foreach (var item in ks.inputDevicePartList)
  21. {
  22. kspart = item as InputDeviceKSPart;
  23. if (!is6dof)
  24. {
  25. kspart.inputDataGetKS.inputDataGetKSPosture.isKS_3DofMode = true;
  26. kspart.inputDeviceKSPartUI.ModelGC._modelPositionDeltaWithDevice.z = _modelPosOffset;
  27. kspart.inputDataGetKS.inputDataGetKSPosture.delayOffset = -(Vector3.forward * _delayOffset);
  28. kspart.inputDataKS.PostureType = SC.XR.Unity.Module_InputSystem.InputDeviceGC.PostureType._3Dof;
  29. }
  30. else
  31. {
  32. kspart.inputDataGetKS.inputDataGetKSPosture.isKS_3DofMode = false;
  33. kspart.inputDeviceKSPartUI.ModelGC._modelPositionDeltaWithDevice.z = 0;
  34. kspart.inputDataGetKS.inputDataGetKSPosture.delayOffset = Vector3.zero;
  35. kspart.inputDataKS.PostureType = SC.XR.Unity.Module_InputSystem.InputDeviceGC.PostureType._6Dof;
  36. }
  37. }
  38. }
  39. }