QRayCaster Class

( Qt3DRender::QRayCaster )

Qt3DRender::QRayCaster is used to perform ray casting tests in 3d world coordinates. 更多...

头: #include <QRayCaster>
qmake: QT += 3drender
Since: Qt 5.11
实例化: RayCaster
继承: Qt3DRender::QAbstractRayCaster

特性

公共函数

QRayCaster (Qt3DCore::QNode * parent = nullptr)
QVector3D direction () const
float length () const
QVector3D origin () const

公共槽

void setDirection (const QVector3D & direction )
void setLength (float length )
void setOrigin (const QVector3D & origin )
void trigger ()
void trigger (const QVector3D & origin , const QVector3D & direction , float length )

信号

void directionChanged (const QVector3D & direction )
void lengthChanged (float length )
void originChanged (const QVector3D & origin )

静态公共成员

const QMetaObject staticMetaObject

保护函数

QRayCaster (Qt3DRender::QAbstractRayCasterPrivate & dd , Qt3DCore::QNode * parent = nullptr)

详细描述

Qt3DRender::QRayCaster is used to perform ray casting tests in 3d world coordinates.

The 3d ray is defined by its origin, direction and length. It will be affected by the transformations applied to the entity it belongs to.

Ray casting tests will be performed every frame as long as the component is enabled. The hits property will be updated with the list of intersections.

另请参阅 QAbstractRayCaster and QScreenRayCaster .

特性文档编制

direction : QVector3D

Holds the direction of the 3D ray. This should be a unit vector.

访问函数:

QVector3D direction () const
void setDirection (const QVector3D & direction )

通知程序信号:

void directionChanged (const QVector3D & direction )

length : float

Holds the length of the 3D ray.

访问函数:

float length () const
void setLength (float length )

通知程序信号:

void lengthChanged (float length )

origin : QVector3D

Holds the origin of the 3D ray in local coordinates.

访问函数:

QVector3D origin () const
void setOrigin (const QVector3D & origin )

通知程序信号:

void originChanged (const QVector3D & origin )

成员函数文档编制

QRayCaster:: QRayCaster ( Qt3DCore::QNode * parent = nullptr)

Default constructs an instance of QRayCaster.

[protected] QRayCaster:: QRayCaster ( Qt3DRender::QAbstractRayCasterPrivate & dd , Qt3DCore::QNode * parent = nullptr)

Default constructs an instance of QRayCaster.

[slot] void QRayCaster:: setLength ( float length )

Sets the length of the ray to length .

If the value is less than or equal to zero, the ray is concidered to be infinite.

注意: setter 函数对于特性 length .

另请参阅 length ().

[slot] void QRayCaster:: trigger ()

Convenience method to enable the component and trigger tests using the current ray.

[slot] void QRayCaster:: trigger (const QVector3D & origin , const QVector3D & direction , float length )

Convenience method to set the ray details origin , direction ,和 length , and enable the component to trigger tests.