本页内容

pickResult QML Value Type

包含选定操作的结果。更多...

Import Statement: import QtQuick3D

属性

详细说明

作为对View3D::pick 的返回对象而创建。

属性文档

distance : real [read-only]

该属性存储了拾取原点与命中位置之间的距离,即光线长度。如果使用视口坐标进行拾取,则拾取原点即为活动摄像机的位置。

hitType : enumeration [read-only, since 6.8]

该属性存储选中结果的命中类型。

常量描述
PickResult.Null拾取操作未命中任何对象。
PickResult.Model拾取击中了一个模型。
PickResult.Item选中操作击中了一个QQuickItem 。

该属性在 Qt 6.8 中引入。

instanceIndex : int [read-only, since 6.5]

当选择操作命中实例化模型的某个实例时,该属性保存实例表中的索引。

该属性在 Qt 6.5 中引入。

itemHit : Item [read-only, since 6.8]

该属性存储被选中的Qt Quick 项。如果hitType 不属于pickResult.Item ,则该值为null。

该属性在 Qt 6.8 中引入。

另请参阅 objectHit 。

normal : vector3d [read-only]

该属性在局部坐标系中存储被击中的面的法线。

注意:这是面的 几何法线,对于被击中背面的一面,该法线指向与光线相反的方向。只有当材质的“cull mode ”未将其剔除时,才会选取背面。

注意:对于 2D 项,该值始终为 (0, 0, 1)。

objectHit : Model [read-only]

该属性保存被选中操作命中的模型对象。如果hitType 未被pickResult.Model ,则该值为null。

另请参阅 itemHit 。

position : vector3d [read-only]

该属性存储了命中点在本地坐标系中的场景位置。

sceneNormal : vector3d [read-only]

该属性存储了在场景坐标系中被击中的面的法线。

scenePosition : vector3d [read-only]

该属性保存了命中点的场景位置。

uvPosition : vector2d [read-only]

该属性存储命中点的 UV 位置。UV 位置是根据命中点相对于边界体积的归一化局部 x 和 y 坐标计算得出的。该属性有助于针对屏幕外渲染的对象进行进一步的选中操作。

当hitType 的值为pickResult.Item 时,该值将表示命中点在itemHit 坐标系中的位置。

© 2026 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.