QAbstractRayCaster¶

PyQt5.Qt3DRender.QAbstractRayCaster

Inherits from QComponent.

Inherited by QRayCaster, QScreenRayCaster.

Description¶

An abstract base class for ray casting in 3d scenes.

QAbstractRayCaster is an abstract base class for casting rays into a 3d scene. QAbstractRayCaster can not be directly instantiated, but rather through its subclasses. QAbstractRayCaster specifies common properties for all ray casters, such as run mode and layer handling, while leaving the actual ray casting details to the subclasses.

Ray castings differs from picking (using QObjectPicker) in that it does not require mouse events to trigger.

By default, the instances of QAbstractRayCaster are disabled. When enabled, the specified ray will be tested for intersecting objects at every frame. The QAbstractRayCaster::hits property will be updated with the results of the ray casting, even if no objects are found.

The QPickingSettings can be used to control the ray casting, such as which primitives are tested and how the results are returned.

Furthermore, QLayer components can be used to control how entities, or entity sub-graphs, react to ray casting.

Note: Components derived from QAbstractRayCaster should not be shared amount multiple entities.

Enums¶

FilterMode

Specifies the rules for selecting entities to test for raycasting.

Member

Value

Description

AcceptAllMatchingLayers

1

Accept entities that reference all the QLayer objects added to this __init__()

AcceptAnyMatchingLayers

0

Accept entities that reference one or more QLayer objects added to this __init__(). This is the default

DiscardAllMatchingLayers

3

Discard entities that reference all QLayer objects added to this __init__()

DiscardAnyMatchingLayers

2

Discard entities that reference one or more QLayer objects added to this __init__()


RunMode

This enumeration specifies how often ray casting is performed

Member

Value

Description

Continuous

0

Ray casting is performed at every frame as long as the component is enabled.

SingleShot

1

Ray casting is done once then the component disables itself. This is the default

Methods¶

__init__(parent: QNode = None)

TODO


addLayer(QLayer)

Add layer to the current list of layers


filterMode() → FilterMode

See also

setFilterMode().


hits() → List[QRayCasterHit]

TODO


layers() → List[QLayer]

Returns the current list of layers


removeLayer(QLayer)

Remove layer from the current list of layers


runMode() → RunMode

See also

setRunMode().


sceneChangeEvent(QSceneChange)

TODO


setFilterMode(FilterMode)

See also

filterMode().


setRunMode(RunMode)

See also

runMode().

Signals¶

filterModeChanged(FilterMode)

TODO


hitsChanged(Iterable[QRayCasterHit])

TODO


runModeChanged(RunMode)

TODO