DragPointChain.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using UnityEngine;
  2. namespace MeidoPhotoStudio.Plugin
  3. {
  4. public abstract class DragPointChain : DragPointMeido
  5. {
  6. protected readonly TBody.IKCMO IK = new TBody.IKCMO();
  7. protected readonly Quaternion[] jointRotation = new Quaternion[3];
  8. protected IKCtrlData ikCtrlData;
  9. protected Transform[] ikChain;
  10. public override void Set(Transform myObject)
  11. {
  12. base.Set(myObject);
  13. ikChain = new Transform[] {
  14. myObject.parent,
  15. myObject.parent,
  16. myObject
  17. };
  18. ikCtrlData = IkCtrlData;
  19. }
  20. protected void InitializeRotation()
  21. {
  22. for (int i = 0; i < jointRotation.Length; i++) jointRotation[i] = ikChain[i].localRotation;
  23. }
  24. protected override void OnMouseDown()
  25. {
  26. base.OnMouseDown();
  27. InitializeRotation();
  28. InitializeIK(IK, ikChain[jointUpper], ikChain[jointMiddle], ikChain[jointLower]);
  29. }
  30. }
  31. }