XrSpatialAnchor QML Type
跟踪真实空间中的特定位置或物体。更多
Import Statement: | import QtQuick3D.Xr |
Since: | Qt 6.8 |
Inherits: | |
Status: | Technical Preview |
属性
- Classification : enumeration
- classification : enumeration
- classificationString : string
- extent2D : vector2d
- extent3D : vector3d
- has2DBounds : bool
- has3DBounds : bool
- identifier : string
- offset2D : vector2d
- offset3D : vector3d
- position : vector3d
- rotation : quaternion
详细说明
该类型表示空间锚,可跟踪现实空间中的特定位置或物体。它提供有关锚点位置、旋转、分类和边界的信息。
空间锚点可通过XrSpatialAnchorListModel 访问。
注: 系统提供锚对象。它们不能在 QML 中创建。
有关如何使用该类型,请参阅Qt Quick 3D - XR 空间锚示例。
平台说明
Meta Quest 设备
此 API 使用 Meta Quest 场景和空间锚点 API。您需要在应用程序的AndroidManifest.xml
文件中添加以下权限:
<uses-permission android:name="com.oculus.permission.USE_ANCHOR_API"/> <uses-permission android:name="com.oculus.permission.USE_SCENE"/>
注意: 在运行应用程序之前,您需要手动设置空间,否则锚点将不可用。
属性文档
Classification : enumeration |
空间锚点的分类。
分类枚举提供了一组预定义的类别类型,用于描述空间锚点的用途或上下文。
常量 | 说明 |
---|---|
Classification.Unknown | 标签尚未设置或识别。 |
Classification.Wall | 锚点代表墙壁。 |
Classification.Ceiling | 锚点代表天花板。 |
Classification.Floor | 锚点代表地板。 |
Classification.Table | 锚点代表桌子。 |
Classification.Seat | 锚点代表座位。 |
Classification.Window | 锚点代表窗户 |
Classification.Door | 锚栓代表门 |
Classification.Other | 锚没有被识别为上述任何类型。请参阅:classificationString |
下表显示了Qt Quick 3D Xr、OpenXR 和 VisionOS 中分类类型之间的映射。如果来自系统的分类类型不属于定义的类型,那么类型将设置为Other
,系统类型由classificationString 属性提供。
注: 分类字符串也可以是Other
。
类型 | OpenXR | VisionOS | 描述 |
---|---|---|---|
未知 | - | - | 标签尚未设置或识别。 |
墙面 | 墙面 | 墙面 | 锚点代表一面墙。 |
天花板 | 天花板 | 天花板 | 锚点代表天花板。 |
地板 | 地板 | 地板 | 锚点代表地板。 |
桌子 | 表格 | 桌子 | 锚点代表一张桌子。 |
座椅 | 沙发 | 座椅 | 锚点代表座位。 |
窗户 | 窗框 | 窗户 | 锚点代表窗户。 |
门 | 门框 | 门 | 锚点代表一扇门。 |
其他 | - | - | 锚点代表其他东西。参见:classificationString |
classification : enumeration |
空间锚点的分类类型。
该属性返回该锚点的classification type (如Table
或Floor
),描述了锚点的目的或上下文。
注意: 来自系统的分类类型可能不在Classification 枚举定义的标签集中,在这种情况下,类型将被设置为Other
,而classificationString 属性将包含原始标签。
另请参阅 classificationString 。
classificationString : string |
空间锚点的分类类型(字符串)。
如果存在分类类型,该属性将以字符串形式返回分类类型。如果分类类型不在Classification 枚举定义的类型集中,则标签将设为Other
,该属性可用于访问系统报告的类型。
注: 该字符串可以为空,也可以更改,具体取决于系统和锚点的分类方式。
另请参阅 classification 。
extent2D : vector2d |
extent3D : vector3d |
has2DBounds : bool |
表示空间锚点是否有二维边界。
如果空间锚点有二维边界(由offset2D 和extent2D 描述),则该属性为true
,表示空间锚点代表一个平面(例如地板或墙)。
否则,返回 false。
另请参阅 offset2D,extent2D, 和has3DBounds 。
has3DBounds : bool |
表示空间锚点是否有三维边界。
如果空间锚点有三维边界,则此属性返回true
,表示空间锚点代表一个体积(如桌子或柜子)。边界由offset3D 和extent3D 描述。
否则,返回false
。
另请参阅 offset3D,extent3D, 和has2DBounds 。
identifier : string |
该空间锚点的唯一标识符。
该属性包含与空间锚相关联的唯一标识符。这与XrSpatialAnchorListModel 引用的标识符相同。
offset2D : vector2d |
offset3D : vector3d |
position : vector3d |
空间锚点的位置。
该属性返回空间锚点在会话坐标系中原点的三维位置(以米为单位)。
rotation : quaternion |
空间锚点的方向。
该属性提供空间锚的旋转(四元数)。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.