PySide6.Qt3DRender.Qt3DRender.QRayCasterHit

class QRayCasterHit

投射光线通过模型时的命中详情。更多

概要

属性

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

QRayCasterHit 包含使用 QRayCasterQScreenRayCaster 组件通过模型投射射线时成功命中的详细信息。

另请参阅

QRayCaster QScreenRayCaster QPickingSettings

class HitType

指定返回的命中类型。这是通过使用QPickingSettings来控制的。

常量

描述

Qt3DRender.QRayCasterHit.TriangleHit

拾取的图元是一个三角形,顶点索引指的是组成三角形的三个点

Qt3DRender.QRayCasterHit.LineHit

拾取的图元是一条线段,前两个顶点指的是构成这条线的两个点

Qt3DRender.QRayCasterHit.PointHit

拾取的图元是一个单点;所有3个顶点索引将未定义

Qt3DRender.QRayCasterHit.EntityHit

仅考虑了边界体积;基元和顶点索引将未定义

注意

当使用from __feature__ import true_property时,属性可以直接使用,否则通过访问器函数使用。

property distanceᅟ: float
Access functions:
property entityᅟ: QEntity
Access functions:
property entityIdᅟ: QNodeId
Access functions:
property localIntersectionᅟ: QVector3D
Access functions:
property primitiveIndexᅟ: int
Access functions:
property typeᅟ: Qt3DRender.QRayCasterHit.HitType
Access functions:
property vertex1Indexᅟ: int
Access functions:
property vertex2Indexᅟ: int
Access functions:
property vertex3Indexᅟ: int
Access functions:
property worldIntersectionᅟ: QVector3D
Access functions:
__init__()
__init__(other)
Parameters:

其他QRayCasterHit

__init__(type, id, distance, localIntersect, worldIntersect, primitiveIndex, v1, v2, v3)
Parameters:
  • typeHitType

  • idQNodeId

  • distance – 浮点数

  • localIntersectQVector3D

  • worldIntersectQVector3D

  • primitiveIndex – 整数

  • v1 – 整数

  • v2 – int

  • v3 – 整数

distance()
Return type:

浮点数

返回射线原点到交点的距离

属性 distanceᅟ 的获取器。

entity()
Return type:

QEntity

返回指向被击中的实体的指针

属性 entityᅟ 的获取器。

entityId()
Return type:

QNodeId

返回被击中的实体的ID

属性 entityIdᅟ 的获取器。

localIntersection()
Return type:

QVector3D

返回实体坐标系中交点的坐标

属性 localIntersectionᅟ 的获取器。

primitiveIndex()
Return type:

整数

返回所选图元的索引

属性 primitiveIndexᅟ 的获取器。

toString()
Return type:

字符串

type()
Return type:

HitType

返回命中的类型

属性 typeᅟ 的获取器。

vertex1Index()
Return type:

整数

返回所选图元的第一个顶点的索引

属性 vertex1Indexᅟ 的获取器。

vertex2Index()
Return type:

整数

返回所选图元的第二个顶点的索引

属性 vertex2Indexᅟ 的获取器。

vertex3Index()
Return type:

整数

返回所选图元的第三个顶点的索引

属性 vertex3Indexᅟ 的获取器。

worldIntersection()
Return type:

QVector3D

返回模型坐标系中交点的坐标

属性 worldIntersectionᅟ 的获取器。