Table of Contents

Class XRFrame

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll
NOTE
Experimental
A WebXR Device API XRFrame object is passed into the RequestAnimationFrame(XRFrameRequestCallback) callback function and provides access to the information needed in order to render a single frame of animation for an XRSession describing a VR or AR scene. Events which communicate the tracking state of objects also provide an XRFrame reference as part of their structure.
[Value("XRFrame")]
public class XRFrame
Inheritance
XRFrame
Inherited Members

Remarks

In addition to providing a reference to the XRSession for which this frame is to be rendered, the GetViewerPose(XRReferenceSpace) method is provided to obtain the XRViewerPose describing the viewer's position and orientation in space, and GetPose(XRSpace, XRSpace) can be used to create an XRPose describing the relative position of one XRSpace relative to another.

-WebXR Device API
-Spatial tracking in WebXR

See also on MDN

Constructors

XRFrame()

public XRFrame()

Properties

DetectedMeshes

[Value("detectedMeshes")]
public XRMeshSet DetectedMeshes { get; }

Property Value

XRMeshSet

DetectedPlanes

[Value("detectedPlanes")]
public XRPlaneSet DetectedPlanes { get; }

Property Value

XRPlaneSet

PredictedDisplayTime

[Value("predictedDisplayTime")]
public Number PredictedDisplayTime { get; }

Property Value

Number

Session

NOTE
Experimental
An XRFrame object's read-only session property returns the XRSession object that generated the frame.
[Value("session")]
public XRSession Session { get; }

Property Value

XRSession

A XRSession object representing the WebXR session for which
this XRFrame describes the object positions and orientations.

Remarks

TrackedAnchors

NOTE
Experimental
The read-only trackedAnchor property of the XRFrame interface returns an XRAnchorSet object containing all anchors still tracked in the frame.
[Value("trackedAnchors")]
public XRAnchorSet TrackedAnchors { get; }

Property Value

XRAnchorSet

An XRAnchorSet object.

Remarks

Methods

CreateAnchor(XRRigidTransform, XRSpace)

NOTE
Experimental
The createAnchor() method of the XRFrame interface creates a free-floating XRAnchor which will be fixed relative to the real world.
[Value("createAnchor")]
public Task<XRAnchor> CreateAnchor(XRRigidTransform pose, XRSpace space)

Parameters

pose XRRigidTransform
space XRSpace

Returns

Task<XRAnchor>

A {{jsxref("Promise")}} resolving to an XRAnchor object.

Remarks

See CreateAnchor() for creating an anchor from a hit test result that is attached to a real-world object.

-CreateAnchor()

See also on MDN

FillJointRadii(List<XRJointSpace>, Float32Array)

NOTE
Experimental
The fillJointRadii() method of the XRFrame interface populates a {{jsxref("Float32Array")}} with radii for a list of hand joint spaces and returns true if successful for all spaces.
[Value("fillJointRadii")]
public bool FillJointRadii(List<XRJointSpace> jointSpaces, Float32Array radii)

Parameters

jointSpaces List<XRJointSpace>
radii Float32Array

Returns

bool

A boolean indicating if all of the spaces have a valid pose.

Remarks

FillPoses(List<XRSpace>, XRSpace, Float32Array)

NOTE
Experimental
The fillPoses() method of the XRFrame interface populates a {{jsxref("Float32Array")}} with the matrices of the poses relative to a given base space and returns true if successful for all spaces.
[Value("fillPoses")]
public bool FillPoses(List<XRSpace> spaces, XRSpace baseSpace, Float32Array transforms)

Parameters

spaces List<XRSpace>
baseSpace XRSpace
transforms Float32Array

Returns

bool

A boolean indicating if all of the spaces have a valid pose.

Remarks

GetDepthInformation(XRView)

NOTE
Experimental
The getDepthInformation() method of the XRFrame interface returns an XRCPUDepthInformation object containing CPU depth information for the active and animated frame.
[Value("getDepthInformation")]
public XRCPUDepthInformation? GetDepthInformation(XRView view)

Parameters

view XRView

Returns

XRCPUDepthInformation

An XRCPUDepthInformation object.

Remarks

GetHitTestResults(XRHitTestSource)

NOTE
Experimental
The getHitTestResults() method of the XRFrame interface returns an array of XRHitTestResult objects containing hit test results for a given XRHitTestSource.
[Value("getHitTestResults")]
public List<XRHitTestResult> GetHitTestResults(XRHitTestSource hitTestSource)

Parameters

hitTestSource XRHitTestSource

Returns

List<XRHitTestResult>

An array of XRHitTestResult objects.

Remarks

GetHitTestResultsForTransientInput(XRTransientInputHitTestSource)

NOTE
Experimental
The getHitTestResultsForTransientInput() method of the XRFrame interface returns an array of XRTransientInputHitTestResult objects containing transient input hit test results for a given XRTransientInputHitTestSource.
[Value("getHitTestResultsForTransientInput")]
public List<XRTransientInputHitTestResult> GetHitTestResultsForTransientInput(XRTransientInputHitTestSource hitTestSource)

Parameters

hitTestSource XRTransientInputHitTestSource

Returns

List<XRTransientInputHitTestResult>

An array of XRTransientInputHitTestResult objects.

Remarks

GetJointPose(XRJointSpace, XRSpace)

NOTE
Experimental
The getJointPose() method of the XRFrame interface returns an XRJointPose object providing the pose of a hand joint (see XRHand) relative to a given base space.
[Value("getJointPose")]
public XRJointPose? GetJointPose(XRJointSpace joint, XRSpace baseSpace)

Parameters

joint XRJointSpace
baseSpace XRSpace

Returns

XRJointPose

An XRJointPose object specifying the position and orientation of the hand joint, relative to
the XRSpace indicated by baseSpace.

Remarks

GetLightEstimate(XRLightProbe)

NOTE
Experimental
The getLightEstimate() method of the XRFrame interface returns an XRLightEstimate object containing estimated lighting values for a given XRLightProbe.
[Value("getLightEstimate")]
public XRLightEstimate? GetLightEstimate(XRLightProbe lightProbe)

Parameters

lightProbe XRLightProbe

Returns

XRLightEstimate

An XRLightEstimate object or null if the device cannot estimate lighting for this frame.

Remarks

GetPose(XRSpace, XRSpace)

NOTE
Experimental
The XRFrame method getPose() returns the relative position and
orientation—the pose—of one XRSpace to that of another space. With this, you can observe the motion of objects relative to each other and to fixed locations throughout the scene.
[Value("getPose")]
public XRPose? GetPose(XRSpace space, XRSpace baseSpace)

Parameters

space XRSpace
baseSpace XRSpace

Returns

XRPose

An XRPose object specifying the position and orientation, relative to
the XRSpace indicated by baseSpace.

Remarks

For example, to get the position of a controller relative to the viewer's head, you would compare the controller's GripSpace to the XRReferenceSpace of type viewer.

See also on MDN

GetViewerPose(XRReferenceSpace)

NOTE
Experimental
The getViewerPose() method, a member of the XRFrame interface, returns a XRViewerPose object which describes the viewer's pose (position and orientation) relative to the specified reference space.
[Value("getViewerPose")]
public XRViewerPose? GetViewerPose(XRReferenceSpace referenceSpace)

Parameters

referenceSpace XRReferenceSpace

Returns

XRViewerPose

A XRViewerPose describing the viewer's position and orientation relative
to the specified reference space.

Remarks

See the GetPose(XRSpace, XRSpace) method for a way to calculate a pose that represents the difference between two spaces.

See also on MDN