File tree Expand file tree Collapse file tree 5 files changed +18
-11
lines changed
Expand file tree Collapse file tree 5 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ class ArmTransforms extends MonoBehavior
2121 this . armLengthByScale = false ;
2222 this . scaleAxis = Vector3 . one ;
2323 this . scaleHandFactor = .7 ;
24+
25+ this . poseManager = null ;
2426 }
2527
2628 get upperArmLength ( ) {
@@ -51,7 +53,7 @@ class ArmTransforms extends MonoBehavior
5153 updateArmLengths ( )
5254 {
5355 const shoulderWidth = new Vector3 ( ) . subVectors ( this . upperArm . position , this . lowerArm . position ) . magnitude ;
54- const _armLength = ( PoseManager . Instance . playerWidthWrist - shoulderWidth ) / 2 ;
56+ const _armLength = ( this . poseManager . playerWidthWrist - shoulderWidth ) / 2 ;
5557 this . setArmLength ( _armLength ) ;
5658 }
5759
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import StaticOffsetTransform from './StaticOffsetTransform.js';
1414 this . rightHand = null ;
1515
1616 this . unity = unity ;
17+ this . poseManager = null ;
1718 }
1819
1920 Awake ( )
@@ -77,10 +78,10 @@ import StaticOffsetTransform from './StaticOffsetTransform.js';
7778 sot.reference = this.transform.parent;
7879 } */
7980
80- this . head . reference = this . head . reference !== null ? this . head . reference : PoseManager . Instance . vrTransforms . head ;
81- // this.hmd.reference = this.hmd.reference !== null ? this.hmd.reference : PoseManager.Instance .vrTransforms.hmd;
82- this . leftHand . reference = this . leftHand . reference !== null ? this . leftHand . reference : PoseManager . Instance . vrTransforms . leftHand ;
83- this . rightHand . reference = this . rightHand . reference !== null ? this . rightHand . reference : PoseManager . Instance . vrTransforms . rightHand ;
81+ this . head . reference = this . head . reference !== null ? this . head . reference : this . poseManager . vrTransforms . head ;
82+ // this.hmd.reference = this.hmd.reference !== null ? this.hmd.reference : this.poseManager .vrTransforms.hmd;
83+ this . leftHand . reference = this . leftHand . reference !== null ? this . leftHand . reference : this . poseManager . vrTransforms . leftHand ;
84+ this . rightHand . reference = this . rightHand . reference !== null ? this . rightHand . reference : this . poseManager . vrTransforms . rightHand ;
8485 }
8586 }
8687
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class PoseManager extends MonoBehavior
2525
2626 this . flipY = false ;
2727
28- PoseManager . Instance = this ;
28+ // PoseManager.Instance = this;
2929 }
3030
3131 /* OnEnable()
@@ -91,6 +91,6 @@ class PoseManager extends MonoBehavior
9191 this . playerWidthWrist = PlayerPrefs . GetFloat ( "VRArmIK_PlayerWidthWrist" , this . referencePlayerWidthWrist ) ;
9292 }
9393 }
94- PoseManager . Instance = null ;
94+ // PoseManager.Instance = null;
9595
9696export default PoseManager ;
Original file line number Diff line number Diff line change @@ -54,10 +54,11 @@ class ShoulderPoser extends MonoBehavior
5454 this . leftShoulderAnkerStartLocalPosition = new Vector3 ( ) ;
5555 this . rightShoulderAnkerStartLocalPosition = new Vector3 ( ) ;
5656
57+ this . poseManager = this . GetOrAddComponent ( PoseManager ) ;
5758 if ( this . vrTrackingReferences === null )
58- this . vrTrackingReferences = PoseManager . Instance . vrTransforms ;
59+ this . vrTrackingReferences = this . poseManager . vrTransforms ;
5960 if ( this . avatarTrackingReferences === null )
60- this . avatarTrackingReferences = PoseManager . Instance . avatarVrTransforms ;
61+ this . avatarTrackingReferences = this . poseManager . avatarVrTransforms ;
6162 }
6263
6364 Start ( ) {
@@ -210,8 +211,8 @@ class ShoulderPoser extends MonoBehavior
210211 rotateShoulderRightBase ( )
211212 {
212213
213- const heightDiff = this . vrTrackingReferences . head . position . y - PoseManager . Instance . vrSystemOffsetHeight ;
214- const relativeHeightDiff = - heightDiff / PoseManager . Instance . playerHeightHmd ;
214+ const heightDiff = this . vrTrackingReferences . head . position . y - this . poseManager . vrSystemOffsetHeight ;
215+ const relativeHeightDiff = - heightDiff / this . poseManager . playerHeightHmd ;
215216
216217 const hmdRotation = this . vrTrackingReferences . head . rotation ;
217218 hmdRotation . multiply ( z180Quaternion ) ;
Original file line number Diff line number Diff line change @@ -34,8 +34,11 @@ class ShoulderTransforms extends MonoBehavior
3434 this . rightShoulderAnchor = new Transform ( ) ;
3535 this . transform . AddChild ( this . rightShoulderAnchor ) ;
3636
37+ const poseManager = this . GetOrAddComponent ( PoseManager ) ;
3738 this . leftArm = unity . makeGameObject ( ) . AddComponent ( ArmTransforms ) ;
39+ this . leftArm . poseManager = poseManager ;
3840 this . rightArm = unity . makeGameObject ( ) . AddComponent ( ArmTransforms ) ;
41+ this . rightArm . poseManager = poseManager ;
3942
4043 this . leftShoulderAnchor . AddChild ( this . leftArm . transform ) ;
4144 this . rightShoulderAnchor . AddChild ( this . rightArm . transform ) ;
You can’t perform that action at this time.
0 commit comments