The getDepthInMeters()
method of the XRCPUDepthInformation
interface returns the depth in meters at (x, y) in normalized view coordinates (origin in the top left corner).
Syntax
Parameters
-
x
-
X coordinate (origin at the left, grows to the right).
-
y
-
Y coordinate (origin at the top, grows downward).
Return value
Exceptions
- A
RangeError
is thrown if x
or y
are greater than 1.0 or less than 0.0.
Examples
const distance = depthInfo.getDepthInMeters(x, y);
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
getDepthInMeters |
90 |
90 |
No |
No |
76 |
No |
No |
90 |
No |
64 |
No |
15.0 |