@@ -142,6 +142,13 @@ setTimeout(function () {
142
142
this . handIndex = 0 ;
143
143
this . triggerIndex = 0 ;
144
144
this . squeezeIndex = 0 ;
145
+ this . pointerPositionXIndex = 0 ;
146
+ this . pointerPositionYIndex = 0 ;
147
+ this . pointerPositionZIndex = 0 ;
148
+ this . pointerRotationXIndex = 0 ;
149
+ this . pointerRotationYIndex = 0 ;
150
+ this . pointerRotationZIndex = 0 ;
151
+ this . pointerRotationWIndex = 0 ;
145
152
this . jointsStartIndex = 0 ;
146
153
this . poses = new Float32Array ( 16 * 25 ) ;
147
154
this . radii = new Float32Array ( 25 ) ;
@@ -157,6 +164,13 @@ setTimeout(function () {
157
164
this . handIndex = index ++ ;
158
165
this . triggerIndex = index ++ ;
159
166
this . squeezeIndex = index ++ ;
167
+ this . pointerPositionXIndex = index ++ ;
168
+ this . pointerPositionYIndex = index ++ ;
169
+ this . pointerPositionZIndex = index ++ ;
170
+ this . pointerRotationXIndex = index ++ ;
171
+ this . pointerRotationYIndex = index ++ ;
172
+ this . pointerRotationZIndex = index ++ ;
173
+ this . pointerRotationWIndex = index ++ ;
160
174
this . jointsStartIndex = index ;
161
175
}
162
176
}
@@ -718,6 +732,19 @@ setTimeout(function () {
718
732
xrHand . bufferJointIndex ++ ;
719
733
}
720
734
}
735
+ // Get pointer pose for hand
736
+ var inputRayPose = frame . getPose ( inputSource . targetRaySpace , refSpace ) ;
737
+ if ( inputRayPose ) {
738
+ var position = inputRayPose . transform . position ;
739
+ var orientation = inputRayPose . transform . orientation ;
740
+ Module . HEAPF32 [ xrHand . pointerPositionXIndex ] = position . x ; // XRHandData.pointerPositionX
741
+ Module . HEAPF32 [ xrHand . pointerPositionYIndex ] = position . y ; // XRHandData.pointerPositionY
742
+ Module . HEAPF32 [ xrHand . pointerPositionZIndex ] = - position . z ; // XRHandData.pointerPositionZ
743
+ Module . HEAPF32 [ xrHand . pointerRotationXIndex ] = - orientation . x ; // XRHandData.pointerRotationX
744
+ Module . HEAPF32 [ xrHand . pointerRotationYIndex ] = - orientation . y ; // XRHandData.pointerRotationY
745
+ Module . HEAPF32 [ xrHand . pointerRotationZIndex ] = orientation . z ; // XRHandData.pointerRotationZ
746
+ Module . HEAPF32 [ xrHand . pointerRotationWIndex ] = orientation . w ; // XRHandData.pointerRotationW
747
+ }
721
748
} else if ( inputSource . gripSpace ) {
722
749
var inputRayPose = frame . getPose ( inputSource . targetRaySpace , refSpace ) ;
723
750
if ( inputRayPose ) {
@@ -890,7 +917,7 @@ setTimeout(function () {
890
917
this . xrData . controllerA . setIndices ( Module . ControllersArrayOffset ) ;
891
918
this . xrData . controllerB . setIndices ( Module . ControllersArrayOffset + 34 ) ;
892
919
this . xrData . handLeft . setIndices ( Module . HandsArrayOffset ) ;
893
- this . xrData . handRight . setIndices ( Module . HandsArrayOffset + 205 ) ;
920
+ this . xrData . handRight . setIndices ( Module . HandsArrayOffset + 212 ) ;
894
921
this . xrData . viewerHitTestPose . setIndices ( Module . ViewerHitTestPoseArrayOffset ) ;
895
922
this . xrData . controllerA . updatedProfiles = 0 ;
896
923
this . xrData . controllerB . updatedProfiles = 0 ;
0 commit comments