QAbstractRayCaster¶
An abstract base class for ray casting in 3d scenes. More…
Inherited by: QScreenRayCaster, QRayCaster
New in version 5.11.
Synopsis¶
Functions¶
def
addLayer
(layer)def
filterMode
()def
hits
()def
layers
()def
removeLayer
(layer)def
runMode
()
Slots¶
def
setFilterMode
(filterMode)def
setRunMode
(runMode)
Signals¶
def
filterModeChanged
(filterMode)def
hitsChanged
(hits)def
runModeChanged
(runMode)
Detailed Description¶
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 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.
See also
QRayCaster
QScreenRayCaster
QObjectPicker
QPickingSettings
QNoPicking
- class PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster([parent=None])¶
- Parameters
parent –
PySide6.Qt3DCore.Qt3DCore.QNode
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.RunMode¶
This enumeration specifies how often ray casting is performed
Constant
Description
Qt3DRender.QAbstractRayCaster.Continuous
Ray casting is performed at every frame as long as the component is enabled.
Qt3DRender.QAbstractRayCaster.SingleShot
Ray casting is done once then the component disables itself. This is the default
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.FilterMode¶
Specifies the rules for selecting entities to test for raycasting.
Constant
Description
Qt3DRender.QAbstractRayCaster.AcceptAnyMatchingLayers
Accept entities that reference one or more
QLayer
objects added to thisQAbstractRayCaster
. This is the defaultQt3DRender.QAbstractRayCaster.AcceptAllMatchingLayers
Accept entities that reference all the
QLayer
objects added to thisQAbstractRayCaster
Qt3DRender.QAbstractRayCaster.DiscardAnyMatchingLayers
Discard entities that reference one or more
QLayer
objects added to thisQAbstractRayCaster
Qt3DRender.QAbstractRayCaster.DiscardAllMatchingLayers
Discard entities that reference all
QLayer
objects added to thisQAbstractRayCaster
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.addLayer(layer)¶
- Parameters
Add layer
to the current list of layers
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.filterMode()¶
- Return type
Holds the filter mode specifying the entities to select for ray casting tests.
The default value is AcceptMatchingLayers.
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.filterModeChanged(filterMode)¶
- Parameters
filterMode –
FilterMode
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.hits()¶
- Return type
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.hitsChanged(hits)¶
- Parameters
hits –
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.layers()¶
- Return type
Returns the current list of layers
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.removeLayer(layer)¶
- Parameters
Remove layer
from the current list of layers
Holds the run mode controlling how often ray casting tests are performed.
If set to SingleShot
(the default), when the component is enabled, a single ray casting test will be performed and the component will automatically disable itself.
If set to Continuous, ray casting tests will be performed at every frame as long as the component is enabled.
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.runModeChanged(runMode)¶
- Parameters
runMode –
RunMode
- PySide6.Qt3DRender.Qt3DRender.QAbstractRayCaster.setFilterMode(filterMode)¶
- Parameters
filterMode –
FilterMode
Holds the filter mode specifying the entities to select for ray casting tests.
The default value is AcceptMatchingLayers.
Holds the run mode controlling how often ray casting tests are performed.
If set to SingleShot
(the default), when the component is enabled, a single ray casting test will be performed and the component will automatically disable itself.
If set to Continuous, ray casting tests will be performed at every frame as long as the component is enabled.
© 2022 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.