QRayCaster Class

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

该类在 Qt 5.11 引入。

特性

公共函数

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 (const QVector3D & origin , const QVector3D & direction , float length )
void trigger ()

信号

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

详细描述

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 , QScreenRayCaster ,和 QNoPicking .

特性文档编制

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 )

成员函数文档编制

[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 (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.

[slot] void QRayCaster:: trigger ()

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