-
Notifications
You must be signed in to change notification settings - Fork 22.5k
/
index.md
51 lines (37 loc) · 1.62 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
title: "XRRigidTransform: orientation property"
short-title: orientation
slug: Web/API/XRRigidTransform/orientation
page-type: web-api-instance-property
browser-compat: api.XRRigidTransform.orientation
---
{{APIRef("WebXR Device API")}}{{SecureContext_Header}}
The read-only {{domxref("XRRigidTransform")}} property
**`orientation`** is a {{domxref("DOMPointReadOnly")}}
containing a normalized {{Glossary("quaternion")}} (also called a **unit
quaternion** or **[versor](https://en.wikipedia.org/wiki/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
A {{domxref("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.
## Examples
To create a reference space which is oriented to look straight up, positioned 2 meters
off of ground level:
```js
xrReferenceSpace = refSpace.getOffsetReferenceSpace(
new XRRigidTransform({ y: -2 }, { x: 0.0, y: 1.0, z: 0.0, w: 1.0 }),
);
```
The unit quaternion specified here is \[0.0, 1.0, 0.0, 1.0] to indicate that the object
should be facing directly along the _y_ axis.
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [Movement, orientation, and motion](/en-US/docs/Web/API/WebXR_Device_API/Movement_and_motion)
- [Unit quaternions](https://en.wikipedia.org/wiki/Versor)
- [Quaternions and spatial rotation](https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation)