SkeletalFinger.cs 809 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using UnityEngine;
  3. namespace Leap.Unity
  4. {
  5. public class SkeletalFinger : FingerModel
  6. {
  7. public override void InitFinger()
  8. {
  9. this.SetPositions();
  10. }
  11. public override void UpdateFinger()
  12. {
  13. Debug.Log("SkeletalFinger.SetPositions()");
  14. this.SetPositions();
  15. }
  16. protected void SetPositions()
  17. {
  18. for (int i = 0; i < this.bones.Length; i++)
  19. {
  20. if (this.bones[i] != null)
  21. {
  22. this.bones[i].transform.position = base.GetBoneCenter(i);
  23. this.bones[i].transform.rotation = base.GetBoneRotation(i);
  24. }
  25. }
  26. for (int j = 0; j < this.joints.Length; j++)
  27. {
  28. if (this.joints[j] != null)
  29. {
  30. this.joints[j].transform.position = base.GetJointPosition(j + 1);
  31. this.joints[j].transform.rotation = base.GetBoneRotation(j + 1);
  32. }
  33. }
  34. }
  35. }
  36. }