Table of Contents

Class XRRigidTransform

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The XRRigidTransform is a WebXR API interface that represents the 3D geometric transform described by a position and orientation.

[Value("XRRigidTransform")]
public class XRRigidTransform
Inheritance
XRRigidTransform
Inherited Members

Remarks

XRRigidTransform is used to specify transforms throughout the WebXR APIs, including:

Using XRRigidTransform in these places rather than bare arrays that provide the matrix data has an advantage. It automatically computes the inverse of the transform and even caches it making subsequent requests significantly faster.

See also on MDN

Constructors

XRRigidTransform()

public XRRigidTransform()

XRRigidTransform(DOMPointInit, DOMPointInit)

The
XRRigidTransform() constructor creates
a new XRRigidTransform object, representing the position and
orientation of a point or object. Among other things,
XRRigidTransform is used when providing a transform to translate between
coordinate systems across spaces.

public XRRigidTransform(DOMPointInit position = null, DOMPointInit orientation = null)

Parameters

position DOMPointInit
orientation DOMPointInit

Remarks

Properties

Inverse

The read-only inverse property
of the XRRigidTransform interface returns another
XRRigidTransform object which is the inverse of its owning
transform. That is, you can always get the inverse of any
XRRigidTransform using its inverse property, instead of having
to explicitly generate it.

[Value("inverse")]
public XRRigidTransform Inverse { get; }

Property Value

XRRigidTransform

An XRRigidTransform which contains the inverse of the
XRRigidTransform on which it's accessed.Applying the inverse of a transform to any object previously transformed by the parent
XRRigidTransform always undoes the transformation, resulting in the object
returning to its previous pose. In other words, its position and orientation both return
to their prior configurations.

Remarks

Matrix

The read-only XRRigidTransform property matrix returns the transform matrix represented by the object. The returned matrix can then be premultiplied with a column vector to rotate the vector by the 3D rotation specified by the Orientation, then translate it by the Position.

[Value("matrix")]
public Float32Array Matrix { get; }

Property Value

Float32Array

A {{jsxref("Float32Array")}} containing 16 entries, which represents the 4x4 transform matrix described by the Position and Orientation properties.

Remarks

Orientation

The read-only XRRigidTransform property
orientation is a DOMPointReadOnly
containing a normalized quaternion (also called a unit
quaternion or versor)
specifying the rotational component of the transform represented by the object.
If you specify a quaternion whose length is not exactly 1.0 meters, it will be
normalized for you.

[Value("orientation")]
public DOMPointReadOnly Orientation { get; }

Property Value

DOMPointReadOnly

A DOMPointReadOnly object which contains a unit quaternion providing the
orientation component of the transform. As a unit quaternion, the length of the returned
quaternion is always 1.0 meters.

Remarks

Position

The read-only XRRigidTransform property
position is a DOMPointReadOnly object which
provides the 3D point, specified in meters, describing the translation component of the
transform.

[Value("position")]
public DOMPointReadOnly Position { get; }

Property Value

DOMPointReadOnly

A read-only DOMPointReadOnly indicating the 3D position component of the
transform matrix. The units are meters.

NOTE
The w component of the point is always 1.0.

Remarks