BT3DofDevicePartManipulation.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using SC.XR.Unity.Module_InputSystem;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using UnityEngine;
  7. [Obsolete()]
  8. public class BT3DofDevicePartManipulation : AbstractDevicePartManipulation
  9. {
  10. private SCPointEventData eventData;
  11. private SCPose pointerPose;
  12. public override void OneDevicePartInit(ManipulationHandler manipulationHandler, Dictionary<InputDevicePartType, SCPointEventData> eventDataDic, Transform targetTransform, MoveLogic moveLogic, RotateLogic rotateLogic, ScaleLogic scaleLogic)
  13. {
  14. base.OneDevicePartInit(manipulationHandler, eventDataDic, targetTransform, moveLogic, rotateLogic, scaleLogic);
  15. this.eventData = this.eventDataDic.Values.ToArray()[0];
  16. pointerPose = new SCPose(Vector3.zero, Quaternion.identity);
  17. Vector3 grabPosition = Vector3.zero;
  18. pointerPose.position = this.eventData.Position3D;
  19. pointerPose.rotation = Quaternion.identity;
  20. grabPosition = this.eventData.Position3D;
  21. //Head only need to setup movelogic
  22. moveLogic.Setup(pointerPose, grabPosition, targetTransform, targetTransform.localScale);
  23. }
  24. public override Tuple<Vector3, Quaternion, Vector3> OneDevicePartUpdate()
  25. {
  26. pointerPose.position = this.eventData.Position3D;
  27. pointerPose.rotation = Quaternion.identity;
  28. Vector3 position = moveLogic.Update(pointerPose, targetTransform.rotation, targetTransform.localScale, true);
  29. //TODO
  30. return new Tuple<Vector3, Quaternion, Vector3>(position, targetTransform.rotation, targetTransform.localScale);
  31. }
  32. public override void TwoDevicePartInit(ManipulationHandler manipulationHandler, Dictionary<InputDevicePartType, SCPointEventData> eventDataDic, Transform targetTransform, MoveLogic moveLogic, RotateLogic rotateLogic, ScaleLogic scaleLogic)
  33. {
  34. base.TwoDevicePartInit(manipulationHandler, eventDataDic, targetTransform, moveLogic, rotateLogic, scaleLogic);
  35. //TODO
  36. }
  37. public override Tuple<Vector3, Quaternion, Vector3> TwoDevicePartUpdate(Func<Vector3, Vector3> scaleConstraint)
  38. {
  39. //TODO
  40. return new Tuple<Vector3, Quaternion, Vector3>(Vector3.zero, Quaternion.identity, Vector3.one);
  41. }
  42. }