--- title: VRPose slug: Web/API/VRPose tags: - VR - VRPose - WebVR - 实验性的 - 虚拟现实 translation_of: Web/API/VRPose --- <div>{{APIRef("WebVR API")}}{{SeeCompatTable}}</div> <p>The <strong><code>VRPose</code></strong> interface of the <a href="/en-US/docs/Web/API/WebVR_API">WebVR API</a> represents the state of a VR sensor at a given timestamp (which includes orientation, position, velocity, and acceleration information.)</p> <p><a href="/en-US/docs/Web/API/WebVR_API">WebVR API</a> 中的 <strong><code>VRPose</code></strong> 接口表示在一个给定的时间戳中,一个VR传感器的状态(包括了方向、位置、速度和加速度信息)。</p> <p>This interface is accessible through the {{domxref("VRDisplay.getPose()")}} and {{domxref("VRDisplay.getImmediatePose()")}} methods.</p> <p>这个接口能通过 {{domxref("VRDisplay.getPose()")}} 和 {{domxref("VRDisplay.getImmediatePose()")}} 方法访问</p> <h2 id="Properties">Properties</h2> <dl> <dt>{{domxref("VRPose.timeStamp")}} {{readonlyInline}}</dt> <dd>Returns the current time stamp of the system — a monotonically increasing value useful for determining if position data has been updated, and what order updates have occured in.</dd> <dd>返回当前系统的时间戳。此单调递增的值可以有助于确定位置数据是否有更新,以及更新的顺序。</dd> <dt>{{domxref("VRPose.position")}} {{readonlyInline}}</dt> <dd>Returns the position of the {{domxref("VRDisplay")}} at the current {{domxref("VRPose.timestamp")}} as a 3D vector</dd> <dd>以三维向量的形式返回当前时间戳 {{domxref("VRPose.timestamp")}} 时 {{domxref("VRDisplay")}} 的位置信息。</dd> <dt>{{domxref("VRPose.linearVelocity")}} {{readonlyInline}}</dt> <dd>Returns the linear velocity of the {{domxref("VRDisplay")}} at the current {{domxref("VRPose.timestamp")}}, in meters per second.</dd> <dd>返回当前时间戳 {{domxref("VRPose.timestamp")}} 时 {{domxref("VRDisplay")}} 的线速度,单位为米/秒。</dd> <dt>{{domxref("VRPose.linearAcceleration")}} {{readonlyInline}}</dt> <dd>Returns the linear acceleration of the {{domxref("VRDisplay")}} at the current {{domxref("VRPose.timestamp")}}, in meters per second per second.</dd> <dd>返回当前时间戳 {{domxref("VRPose.timestamp")}} 时 {{domxref("VRDisplay")}} 的线加速度,单位为米/平方秒。</dd> <dt>{{domxref("VRPose.orientation")}} {{readonlyInline}}</dt> <dd>Returns the orientation of the sensor at the current {{domxref("VRPose.timestamp")}}, as a quarternion value.</dd> <dd>以四元数的形式返回当前时间戳 {{domxref("VRPose.timestamp")}} 时传感器的方向,</dd> <dt>{{domxref("VRPose.angularVelocity")}} {{readonlyInline}}</dt> <dd>Returns the angular velocity of the {{domxref("VRDisplay")}} at the current {{domxref("VRPose.timestamp")}}, in radians per second.</dd> <dd>返回当前时间戳 {{domxref("VRPose.timestamp")}} 时 {{domxref("VRDisplay")}} 的角速度,单位为弧度/秒。</dd> <dt>{{domxref("VRPose.angularAcceleration")}} {{readonlyInline}}</dt> <dd>Returns the angular acceleration of the {{domxref("VRDisplay")}} at the current {{domxref("VRPose.timestamp")}}, in meters per second per second.</dd> <dd>返回当前时间戳 {{domxref("VRPose.timestamp")}} 时 {{domxref("VRDisplay")}} 的角加速度,单位为弧度/平方秒。</dd> </dl> <h2 id="Examples">Examples</h2> <pre>TBD.</pre> <h2 id="Specifications">Specifications</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> <tr> <td>{{SpecName('WebVR', '#interface-vrpose', 'VRPose')}}</td> <td>{{Spec2('WebVR')}}</td> <td>Initial definition</td> </tr> </tbody> </table> <h2 id="Browser_compatibility">Browser compatibility</h2> <p>{{CompatibilityTable}}</p> <div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari (WebKit)</th> </tr> <tr> <td>Basic support</td> <td>{{CompatVersionUnknown}}</td> <td>{{CompatVersionUnknown}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> </tr> </tbody> </table> </div> <div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> <th>Chrome for Android</th> </tr> <tr> <td>Basic support</td> <td>{{CompatNo}}</td> <td>{{CompatVersionUnknown}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> </tr> </tbody> </table> </div> <h2 id="See_also">See also</h2> <ul> <li><a href="/en-US/docs/Web/API/WebVR_API">WebVR API homepage</a>.</li> <li><a href="http://mozvr.com/">MozVr.com</a> — demos, downloads, and other resources from the Mozilla VR team.</li> </ul>