← Back to Docs
  • index.html
  • Clayground
  • Clayground.Behavior
  • RectTrigger
  • Clayground 2025.2
  • RectTrigger QML Type

    A rectangular trigger area that detects entity entry. More...

    Import Statement: import Clayground.Behavior
    Inherits:

    RectBoxBody

    Signals

    Detailed Description

    RectTrigger is an invisible physics sensor that emits a signal when another physics entity enters its bounds. It uses Box2D sensor fixtures for collision detection without physical response.

    Example usage:

    import Clayground.Behavior
    
    RectTrigger {
        xWu: 10
        yWu: 5
        widthWu: 2
        heightWu: 2
        visible: true  // Show for debugging
        color: "yellow"
        opacity: 0.5
    
        onEntered: (entity) => {
            console.log("Player entered trigger zone!")
        }
    }

    Signal Documentation

    entered(var entity)

    Emitted when a physics entity enters the trigger area.

    entity The physics body that entered the trigger.

    Note: The corresponding handler is onEntered.