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.