QRayCasterHit Class

(Qt3DRender::QRayCasterHit)

Details of a hit when casting a ray through a model. More...

Header: #include <QRayCasterHit>
qmake: QT += 3drender
Since: Qt 5.11

Public Types

enum HitType { TriangleHit, LineHit, PointHit, EntityHit }

Public Functions

QRayCasterHit()
QRayCasterHit(QRayCasterHit::HitType type, Qt3DCore::QNodeId id, float distance, const QVector3D &localIntersect, const QVector3D &worldIntersect, uint primitiveIndex, uint v1, uint v2, uint v3)
QRayCasterHit(const Qt3DRender::QRayCasterHit &other)
~QRayCasterHit()
float distance() const
Qt3DCore::QEntity *entity() const
Qt3DCore::QNodeId entityId() const
QVector3D localIntersection() const
uint primitiveIndex() const
Qt3DRender::QRayCasterHit::HitType type() const
uint vertex1Index() const
uint vertex2Index() const
uint vertex3Index() const
QVector3D worldIntersection() const
Qt3DRender::QRayCasterHit &operator=(const Qt3DRender::QRayCasterHit &other)

Static Public Members

const QMetaObject staticMetaObject

Detailed Description

Details of a hit when casting a ray through a model.

Qt3DRender::QRayCasterHit contains the details of a successful hit when casting a ray through a model using a Qt3DRender::QRayCaster or Qt3DRender::QScreenRayCaster component.

See also Qt3DRender::QRayCaster, Qt3DRender::QScreenRayCaster, and Qt3DRender::QPickingSettings.

Member Type Documentation

enum QRayCasterHit::HitType

Specifies type of hit that was returned. This is controlled using QPickingSettings.

ConstantValueDescription
Qt3DRender::QRayCasterHit::TriangleHit0The picked primitive was a triangle and the vertex indices refer to the three points making up the triangle
Qt3DRender::QRayCasterHit::LineHit1The picked primitive was a line segment, and the first two vertices refer to the two points making up the line
Qt3DRender::QRayCasterHit::PointHit2The picked primitive was a single point; all 3 vertex indices will be undefined
Qt3DRender::QRayCasterHit::EntityHit3Only the bounding volume was considered; the primitive and vertex indices will be undefined

Member Function Documentation

QRayCasterHit::QRayCasterHit()

Default constructs an instance of QRayCasterHit.

QRayCasterHit::QRayCasterHit(QRayCasterHit::HitType type, Qt3DCore::QNodeId id, float distance, const QVector3D &localIntersect, const QVector3D &worldIntersect, uint primitiveIndex, uint v1, uint v2, uint v3)

Default constructs an instance of QRayCasterHit.

QRayCasterHit::QRayCasterHit(const Qt3DRender::QRayCasterHit &other)

Default constructs an instance of QRayCasterHit.

QRayCasterHit::~QRayCasterHit()

Destroys the instance of QRayCasterHit.

float QRayCasterHit::distance() const

Returns the distance between the origin of the ray and the intersection point

Qt3DCore::QEntity *QRayCasterHit::entity() const

Returns a pointer to the entity that was hit

Qt3DCore::QNodeId QRayCasterHit::entityId() const

Returns the id of the entity that was hit

QVector3D QRayCasterHit::localIntersection() const

Returns the coordinates of the intersection point in the entity's coordinate system

uint QRayCasterHit::primitiveIndex() const

Returns the index of the picked primitive

Qt3DRender::QRayCasterHit::HitType QRayCasterHit::type() const

Returns the type of the hit

uint QRayCasterHit::vertex1Index() const

Returns the index of the first vertex of the picked primitive

uint QRayCasterHit::vertex2Index() const

Returns the index of the second vertex of the picked primitive

uint QRayCasterHit::vertex3Index() const

Returns the index of the third vertex of the picked primitive

QVector3D QRayCasterHit::worldIntersection() const

Returns the coordinates of the intersection point in the model's coordinate system

Qt3DRender::QRayCasterHit &QRayCasterHit::operator=(const Qt3DRender::QRayCasterHit &other)

Copy-assignment operator.

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