HandMenu.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using SC.XR.Unity;
  5. using SC.XR.Unity.Module_InputSystem.InputDeviceHand;
  6. public class HandMenu : SCModuleMono {
  7. InputDeviceHandPartUI _inputDeviceHandPartUI;
  8. public InputDeviceHandPartUI inputDeviceHandPartUI {
  9. get {
  10. if(_inputDeviceHandPartUI == null) {
  11. _inputDeviceHandPartUI = GetComponentInParent<InputDeviceHandPartUI>();
  12. }
  13. return _inputDeviceHandPartUI;
  14. }
  15. }
  16. protected InputDataHand inputDataHand {
  17. get {
  18. return inputDeviceHandPartUI?.inputDeviceHandPart.inputDataHand;
  19. }
  20. }
  21. public override void OnSCLateUpdate() {
  22. base.OnSCLateUpdate();
  23. UpdateTransform();
  24. }
  25. protected virtual void UpdateTransform() {
  26. transform.position = inputDataHand.handInfo.right*0.08f+ inputDataHand.handInfo.centerPosition;
  27. transform.rotation = Quaternion.LookRotation(inputDeviceHandPartUI.modelHand.ActiveHandModel.GetJointTransform(FINGER.small, JOINT.Four).transform.up,
  28. inputDeviceHandPartUI.modelHand.ActiveHandModel.GetJointTransform(FINGER.small, JOINT.Four).transform.forward);
  29. //transform.rotation = inputDeviceHandPartUI.modelHand.fingerUI[(int)FINGER.small].jointGameObject[(int)JOINT.Four].transform.rotation;
  30. }
  31. }