SteamVR_Behaviour_SkeletonCustom.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //======= Copyright (c) Valve Corporation, All rights reserved. ===============
  2. using UnityEngine;
  3. using Valve.VR;
  4. namespace Valve.VR
  5. {
  6. /// <summary>
  7. /// The major difference between this component and the standard SteamVR_Behaviour_Skeleton is this one lets you
  8. /// only use the joints you care about. You can set the transforms you're concerned with and ignore the ones you're not.
  9. /// </summary>
  10. public class SteamVR_Behaviour_SkeletonCustom : SteamVR_Behaviour_Skeleton
  11. {
  12. [SerializeField]
  13. protected Transform _wrist;
  14. [SerializeField]
  15. protected Transform _thumbMetacarpal;
  16. [SerializeField]
  17. protected Transform _thumbProximal;
  18. [SerializeField]
  19. protected Transform _thumbMiddle;
  20. [SerializeField]
  21. protected Transform _thumbDistal;
  22. [SerializeField]
  23. protected Transform _thumbTip;
  24. [SerializeField]
  25. protected Transform _thumbAux;
  26. [SerializeField]
  27. protected Transform _indexMetacarpal;
  28. [SerializeField]
  29. protected Transform _indexProximal;
  30. [SerializeField]
  31. protected Transform _indexMiddle;
  32. [SerializeField]
  33. protected Transform _indexDistal;
  34. [SerializeField]
  35. protected Transform _indexTip;
  36. [SerializeField]
  37. protected Transform _indexAux;
  38. [SerializeField]
  39. protected Transform _middleMetacarpal;
  40. [SerializeField]
  41. protected Transform _middleProximal;
  42. [SerializeField]
  43. protected Transform _middleMiddle;
  44. [SerializeField]
  45. protected Transform _middleDistal;
  46. [SerializeField]
  47. protected Transform _middleTip;
  48. [SerializeField]
  49. protected Transform _middleAux;
  50. [SerializeField]
  51. protected Transform _ringMetacarpal;
  52. [SerializeField]
  53. protected Transform _ringProximal;
  54. [SerializeField]
  55. protected Transform _ringMiddle;
  56. [SerializeField]
  57. protected Transform _ringDistal;
  58. [SerializeField]
  59. protected Transform _ringTip;
  60. [SerializeField]
  61. protected Transform _ringAux;
  62. [SerializeField]
  63. protected Transform _pinkyMetacarpal;
  64. [SerializeField]
  65. protected Transform _pinkyProximal;
  66. [SerializeField]
  67. protected Transform _pinkyMiddle;
  68. [SerializeField]
  69. protected Transform _pinkyDistal;
  70. [SerializeField]
  71. protected Transform _pinkyTip;
  72. [SerializeField]
  73. protected Transform _pinkyAux;
  74. protected override void AssignBonesArray()
  75. {
  76. bones[SteamVR_Skeleton_JointIndexes.wrist] = _wrist;
  77. bones[SteamVR_Skeleton_JointIndexes.thumbProximal] = _thumbProximal;
  78. bones[SteamVR_Skeleton_JointIndexes.thumbMiddle] = _thumbMiddle;
  79. bones[SteamVR_Skeleton_JointIndexes.thumbDistal] = _thumbDistal;
  80. bones[SteamVR_Skeleton_JointIndexes.thumbTip] = _thumbTip;
  81. bones[SteamVR_Skeleton_JointIndexes.thumbAux] = _thumbAux;
  82. bones[SteamVR_Skeleton_JointIndexes.indexProximal] = _indexProximal;
  83. bones[SteamVR_Skeleton_JointIndexes.indexMiddle] = _indexMiddle;
  84. bones[SteamVR_Skeleton_JointIndexes.indexDistal] = _indexDistal;
  85. bones[SteamVR_Skeleton_JointIndexes.indexTip] = _indexTip;
  86. bones[SteamVR_Skeleton_JointIndexes.indexAux] = _indexAux;
  87. bones[SteamVR_Skeleton_JointIndexes.middleProximal] = _middleProximal;
  88. bones[SteamVR_Skeleton_JointIndexes.middleMiddle] = _middleMiddle;
  89. bones[SteamVR_Skeleton_JointIndexes.middleDistal] = _middleDistal;
  90. bones[SteamVR_Skeleton_JointIndexes.middleTip] = _middleTip;
  91. bones[SteamVR_Skeleton_JointIndexes.middleAux] = _middleAux;
  92. bones[SteamVR_Skeleton_JointIndexes.ringProximal] = _ringProximal;
  93. bones[SteamVR_Skeleton_JointIndexes.ringMiddle] = _ringMiddle;
  94. bones[SteamVR_Skeleton_JointIndexes.ringDistal] = _ringDistal;
  95. bones[SteamVR_Skeleton_JointIndexes.ringTip] = _ringTip;
  96. bones[SteamVR_Skeleton_JointIndexes.ringAux] = _ringAux;
  97. bones[SteamVR_Skeleton_JointIndexes.pinkyProximal] = _pinkyProximal;
  98. bones[SteamVR_Skeleton_JointIndexes.pinkyMiddle] = _pinkyMiddle;
  99. bones[SteamVR_Skeleton_JointIndexes.pinkyDistal] = _pinkyDistal;
  100. bones[SteamVR_Skeleton_JointIndexes.pinkyTip] = _pinkyTip;
  101. bones[SteamVR_Skeleton_JointIndexes.pinkyAux] = _pinkyAux;
  102. }
  103. }
  104. }