class QObjectPicker

The QObjectPicker class instantiates a component that can be used to interact with a QEntity by a process known as picking. More

Inheritance diagram of PySide6.Qt3DRender.Qt3DRender.QObjectPicker

Synopsis

Properties

Methods

Slots

Signals

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

For every combination of viewport and camera, picking casts a ray through the scene to find entities who’s bounding volume intersects the ray. The bounding volume is computed using the values in the attribute buffer specified by the boundingVolumePositionAttribute of the geometry.

The signals pressed() , released() , clicked() , moved() , entered() , and exited() are emitted when the bounding volume defined by the pickAttribute property intersects with a ray.

Most signals carry a QPickEvent instance. If QPickingSettings::pickMode() is set to TrianglePicking , the actual type of the pick parameter will be QPickTriangleEvent .

Pick queries are performed on mouse press and mouse release. If drag is enabled, queries also happen on each mouse move while any button is pressed. If hover is enabled, queries happen on every mouse move even if no button is pressed.

For generalised ray casting queries, see QRayCaster and QScreenRayCaster .

Note

Instances of this component shouldn’t be shared, not respecting that condition will most likely result in undefined behavior.

Note

The camera far plane value affects picking and produces incorrect results due to floating-point precision if it is greater than ~100 000.

See also

QPickingSettings QGeometry QAttribute QPickEvent QPickTriangleEvent QNoPicking

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property containsMouseᅟ: bool

Specifies if the object picker currently contains the mouse

Access functions:
property dragEnabledᅟ: bool

Specifies if drag is enabled

Access functions:
property hoverEnabledᅟ: bool

Specifies if hover is enabled

Access functions:
property pressedᅟ: bool

Specifies if the object picker is currently pressed

Access functions:
property priorityᅟ: int

The priority to be used when filtering pick results by priority when pickResultMode is set to NearestPriorityPick .

Access functions:
__init__([parent=None])
Parameters:

parentQNode

clicked(pick)
Parameters:

pickQPickEvent

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse click the QPickEvent pick contains details of the event.

containsMouse()
Return type:

bool

Returns true if the object picker currently contains the mouse

Getter of property containsMouseᅟ .

containsMouseChanged(containsMouse)
Parameters:

containsMouse – bool

Notification signal of property containsMouseᅟ .

dragEnabledChanged(dragEnabled)
Parameters:

dragEnabled – bool

Notification signal of property dragEnabledᅟ .

entered()

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on the mouse entering the volume.

exited()

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on the ray exiting the volume.

hoverEnabledChanged(hoverEnabled)
Parameters:

hoverEnabled – bool

Notification signal of property hoverEnabledᅟ .

isDragEnabled()
Return type:

bool

Returns true if dragging is enabled

Getter of property dragEnabledᅟ .

isHoverEnabled()
Return type:

bool

Returns true if hover enabled

Getter of property hoverEnabledᅟ .

isPressed()
Return type:

bool

Getter of property pressedᅟ .

moved(pick)
Parameters:

pickQPickEvent

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse move with a button pressed the QPickEvent pick contains details of the event.

pressed(pick)
Parameters:

pickQPickEvent

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse press the QPickEvent pick contains details of the event.

pressedChanged(pressed)
Parameters:

pressed – bool

Notification signal of property pressedᅟ .

priority()
Return type:

int

See also

setPriority()

Getter of property priorityᅟ .

priorityChanged(priority)
Parameters:

priority – int

Notification signal of property priorityᅟ .

released(pick)
Parameters:

pickQPickEvent

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse release the QPickEvent pick contains details of the event.

setDragEnabled(dragEnabled)
Parameters:

dragEnabled – bool

Sets the dragEnabled Property to dragEnabled

See also

isDragEnabled()

Setter of property dragEnabledᅟ .

setHoverEnabled(hoverEnabled)
Parameters:

hoverEnabled – bool

Sets the hoverEnabled Property to hoverEnabled

See also

isHoverEnabled()

Setter of property hoverEnabledᅟ .

setPriority(priority)
Parameters:

priority – int

Sets the picker’s priority to priority. This is used when the pick result mode on QPickingSettings is set to NearestPriorityPick . Picking results are sorted by highest priority and shortest picking distance.

See also

priority()

Setter of property priorityᅟ .