Skip to content

Commit ba7feab

Browse files
authored
add missing method vector3Distance
1 parent 52f1e57 commit ba7feab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Packages/webxr/Runtime/Plugins/WebGL/webxr.jspre

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,14 @@ void main()
729729
quaternion[1] *= Math.sign( quaternion[1] * ( matrix[offset+8] - matrix[offset+2] ) );
730730
quaternion[2] *= Math.sign( quaternion[2] * ( matrix[offset+1] - matrix[offset+4] ) );
731731
}
732-
732+
733+
XRManager.prototype.vector3Distance = function(ax, ay, az, bx, by, bz) {
734+
return Math.sqrt(
735+
Math.pow(ax - bx, 2) +
736+
Math.pow(ay - by, 2) +
737+
Math.pow(az - bz, 2));
738+
}
739+
733740
XRManager.prototype.getXRControllersData = function(frame, inputSources, refSpace, xrData) {
734741
Module.HEAPF32[xrData.handLeft.frameIndex] = xrData.frameNumber; // XRHandData.frame
735742
Module.HEAPF32[xrData.handRight.frameIndex] = xrData.frameNumber; // XRHandData.frame

0 commit comments

Comments
 (0)