ChangeHandModel.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using SC.XR.Unity.Module_InputSystem;
  2. using SC.XR.Unity.Module_InputSystem.InputDeviceHand;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. public class ChangeHandModel : MonoBehaviour
  7. {
  8. //public Material meshHandMaterial;
  9. public void OnChangeSkeletonHandClick(TouchPointer touchPointer, SCPointEventData eventData)
  10. {
  11. if (eventData.inputDevicePartBase is InputDeviceHandPart)
  12. {
  13. InputDeviceHandPart inputDeviceHandPart = eventData.inputDevicePartBase as InputDeviceHandPart;
  14. ModelHand modelHand = inputDeviceHandPart.inputDeviceHandPartUI.modelHand;
  15. modelHand.HandModelChange(HandModelType.LineRendererHand);
  16. }
  17. }
  18. public void OnChangeHandModelClick(TouchPointer touchPointer, SCPointEventData eventData)
  19. {
  20. if (eventData.inputDevicePartBase is InputDeviceHandPart)
  21. {
  22. InputDeviceHandPart inputDeviceHandPart = eventData.inputDevicePartBase as InputDeviceHandPart;
  23. ModelHand modelHand = inputDeviceHandPart.inputDeviceHandPartUI.modelHand;
  24. modelHand.HandModelChange(HandModelType.MeshHand);
  25. }
  26. }
  27. public void OnChangeNoHandClick(TouchPointer touchPointer, SCPointEventData eventData)
  28. {
  29. if (eventData.inputDevicePartBase is InputDeviceHandPart)
  30. {
  31. InputDeviceHandPart inputDeviceHandPart = eventData.inputDevicePartBase as InputDeviceHandPart;
  32. ModelHand modelHand = inputDeviceHandPart.inputDeviceHandPartUI.modelHand;
  33. modelHand.HandModelChange(HandModelType.EffectHand);
  34. EffectHandModel effectHandModel = modelHand.ActiveHandModel as EffectHandModel;
  35. effectHandModel.ChangeHandColor(new Color(0.5f, 0.5f, 0.5f));
  36. }
  37. }
  38. }