Tracks a specific location or object in real space. 更多...
| import 语句: |
import QtQuick3D.Xr
|
| Since: | Qt 6.8 |
| 继承: | |
| 状态: | 技术预览 |
This type represents a spatial anchor that tracks a specific location or object in real space. It provides information about the anchor's position, rotation, classification, and bounds.
Spatial anchors are accessed through an XrSpatialAnchorListModel .
注意: The system provides Anchor objects. They cannot be created in QML.
见 Qt Quick 3D - XR Spatial Anchors Example for how to use this type.
This API makes use of the Meta Quest Scene and Spatial Anchor APIs. You need to add the following permissions to your app's
AndroidManifest.xml
文件:
<uses-permission android:name="com.oculus.permission.USE_ANCHOR_API"/> <uses-permission android:name="com.oculus.permission.USE_SCENE"/>
注意: You need to manually set up a Space before running an app, or anchors will not be available.
|
分类
:
enumeration
|
The classification of the spatial anchor.
The Classification enum provides a set of predefined category types that describe the purpose or context of a spatial anchor.
| 常量 | 描述 |
|---|---|
Classification.Unknown
|
The label has not been set or identified. |
Classification.Wall
|
The anchor represents a wall. |
Classification.Ceiling
|
The anchor represents a ceiling. |
Classification.Floor
|
The anchor represents a floor. |
Classification.Table
|
The anchor represents a table. |
Classification.Seat
|
The anchor represents a seat. |
Classification.Window
|
The anchor represents a window. |
Classification.Door
|
The anchor represents a door. |
Classification.Other
|
The anchor was not identified as any of the above types. See: classificationString |
The following table shows the mapping between the classification type in Qt Quick 3D Xr, OpenXR, and VisionOS. If the classification type from the system falls outside of the defined types, then the
Type
被设为
Other
, and the system type is provided by the
classificationString
特性。
注意:
The classification string can also be
Other
.
| 类型 | OpenXR | VisionOS | 描述 |
|---|---|---|---|
| 未知 | - | - | The label has not been set or identified. |
| Wall | WALL_FACE | Wall | The anchor represents a wall. |
| Ceiling | CEILING | Ceiling | The anchor represents a ceiling. |
| Floor | FLOOR | Floor | The anchor represents a floor. |
| Table | TABLE | Table | The anchor represents a table. |
| Seat | COUCH | Seat | The anchor represents a seat. |
| Window | WINDOW_FRAME | Window | The anchor represents a window. |
| Door | DOOR_FRAME | Door | The anchor represents a door. |
| 其它 | - | - | The anchor represents something else. See: classificationString |
|
classification
:
enumeration
|
The classification type of the spatial anchor.
This property returns the
classification type
for this anchor (for example,
Table
or
Floor
) describing the anchor's purpose or context.
注意:
The classification type coming from the system might not be in the set of labels defined by the
分类
enum, in which case the type will be set to
Other
和
classificationString
property will contain the original label.
另请参阅 classificationString .
|
classificationString
:
string
|
The classification type of the spatial anchor as a string.
This property returns the classification type as a string if one exists. If the classification type is not in the set of types defined by the
分类
enums, the label is set to
Other
, and this property can be used to access the type as it was reported by the system.
注意: This string can be empty or change, depending on the system and how the anchor gets classified.
另请参阅 classification .
|
extent2D
:
vector2d
|
The 2D extent of the spatial anchor.
This property holds the spatial anchor's size in two dimensions (width and height) within the X/Z plane. It is valid when
has2DBounds
is
true
.
另请参阅 has2DBounds and offset2D .
|
extent3D
:
vector3d
|
The 3D extent of the spatial anchor.
This property specifies the spatial anchor's volume in three dimensions (width, height, and depth). It is valid when
has3DBounds
is
true
.
另请参阅 offset3D and has3DBounds .
|
has2DBounds
:
bool
|
Indicates whether the spatial anchor has 2D bounds.
This property holds
true
if the spatial anchor has 2D bounds, described by
offset2D
and
extent2D
, indicating that it represents a flat surface (for example, a floor or wall).
Otherwise, it returns false.
另请参阅 offset2D , extent2D ,和 has3DBounds .
|
has3DBounds
:
bool
|
Indicates whether the spatial anchor has 3D bounds.
This property returns
true
if the spatial anchor has 3D bounds, indicating that it represents a volume (for example, a table or a cupboard). The bounds are described by
offset3D
and
extent3D
.
Otherwise, it returns
false
.
另请参阅 offset3D , extent3D ,和 has2DBounds .
|
标识符
:
string
|
A unique identifier for this spatial anchor.
This property holds a unique identifier associated with the spatial anchor. This is the same identifier referenced by a XrSpatialAnchorListModel .
|
offset2D
:
vector2d
|
The 2D offset of the spatial anchor.
This property holds the offset of the anchor's bounds within the X/Z plane. It is valid when
has2DBounds
is
true
.
另请参阅 has2DBounds and extent2D .
|
offset3D
:
vector3d
|
The 3D offset of the spatial anchor.
This property provides the 3D offset of the anchor's bounds (in meters) from the anchor's 位置 .
另请参阅 offset3D and has3DBounds .
|
位置
:
vector3d
|
The position of the spatial anchor.
This property returns the 3D position (in meters) of the spatial anchor's origin within the session's coordinate system.
|
rotation
:
quaternion
|
The orientation of the spatial anchor.
This property provides the spatial anchor's rotation (as a quaternion).