TriggerBody QML Type

Reports when objects enter a given volume. More...

Import Statement: import QtQuick3D.Physics
Since: Qt 6.4
Inherits:

PhysicsNode

Properties

Signals

Detailed Description

This type defines a trigger body. A trigger body is a body that does not interact physically but is used to detect when objects intersect with its volume.

Property Documentation

collisionCount : int

This property returns the number of bodies currently colliding with the trigger body.

A body counts once, however many of its collision shapes are inside the trigger body.

Only a body that had sendTriggerReports set when it entered is counted, and it goes on counting for as long as it is inside, whatever it sets that property to in the meantime.

Signal Documentation

bodyEntered(PhysicsNode *body)

This signal is emitted when the trigger body is penetrated by the specified body.

Emitted once per body, however many of its collision shapes penetrate the trigger body.

Note: The corresponding handler is onBodyEntered.

bodyExited(PhysicsNode *body)

This signal is emitted when the trigger body is no longer penetrated by the specified body.

Note: This signal is not emitted for a body that is deleted while it is still inside the trigger body, since there is no longer a body to report. collisionCount does count such a body out, so a list kept by hand from these signals has to be cleared of deleted bodies another way.

Note: The corresponding handler is onBodyExited.