过时
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
resetSensor()
方法在
VRDevice
interface
can be used to reset the sensor if desired, returning the
position and orientation values to zero.
PositionSensorVRDevice.resetSensor();
None.
Void.
我们的
positionsensorvrdevice
demo uses the WebVR API to update the view of a simple
2D canvas
scene on each frame of a
requestAnimationFrame
loop. It features, among other things, a "Reset Sensor" button in the UI, which when pressed runs the
resetSensor()
function on the position sensor. The JavaScript looks like this:
document.querySelector('button').onclick = function() {
gPositionSensor.resetSensor();
}
When the button is pressed, the current position, orientation, etc. of the sensor/head mounted display is set to be 0 — this makes the method useful for calibration when an app is first loaded.
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
resetSensor
弃用
非标
|
Chrome
Yes
|
Edge
79
|
Firefox
39
Disabled
|
IE No | Opera No | Safari No | WebView Android No | Chrome Android No |
Firefox Android
39
Disabled
|
Opera Android No | Safari iOS No | Samsung Internet Android No |
完整支持
不支持
实验。期望将来行为有所改变。
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
见实现注意事项。
用户必须明确启用此特征。
PositionSensorVRDevice
getImmediateState()
getState()
resetSensor()