HandInteractionTouchRotate.cs 793 B

123456789101112131415161718192021222324252627
  1. using SC.XR.Unity.Module_InputSystem;
  2. using SC.XR.Unity.Module_InputSystem.InputDeviceHand;
  3. using UnityEngine;
  4. using UnityEngine.Serialization;
  5. namespace SC.XR.Unity.Module_InputSystem
  6. {
  7. public class HandInteractionTouchRotate : PokeHandler
  8. {
  9. [SerializeField]
  10. [FormerlySerializedAs("TargetObjectTransform")]
  11. private Transform targetObjectTransform = null;
  12. [SerializeField]
  13. private float rotateSpeed = 300.0f;
  14. public override void OnPokeUpdated(TouchPointer touchPointer, SCPointEventData eventData) {
  15. base.OnPokeUpdated(touchPointer, eventData);
  16. if(targetObjectTransform != null) {
  17. targetObjectTransform.Rotate(Vector3.up * (rotateSpeed * Time.deltaTime));
  18. }
  19. }
  20. }
  21. }