Attractor3D QML Type

Attracts particles towards a position or a shape. More...

Import Statement: import QtQuick3D.Particles3D .
Since: Qt 6.1
Inherits:

Affector3D

Properties

Detailed Description

This element attracts particles towards a position inside the 3D view. To model the gravity of a massive object whose center of gravity is far away, use Gravity3D.

The attraction position is defined either with the position and positionVariation or with shape. If both are defined, shape is used.

Property Documentation

duration : int

This property defines the duration in milliseconds how long it takes for particles to reach the attaction position. When the value is -1, particle lifeSpan is used as the duration.

The default value is -1.

durationVariation : int

This property defines the duration variation in milliseconds. The actual duration to reach attractor is between duration - durationVariation and duration + durationVariation.

The default value is 0 (no variation).

hideAtEnd : bool

This property defines if the particle should disappear when it reaches the attractor.

The default value is false.

positionVariation : vector3d

This property defines the variation on attract position. It can be used to not attract into a single point, but randomly towards a wider area. Here is an example how to attract particles into some random point inside (50, 50, 50) cube at position (100, 0, 0) within 2 to 4 seconds:

Attractor3D {
    position: Qt.vector3d(100, 0, 0)
    positionVariation: Qt.vector3d(50, 50, 50)
    duration: 3000
    durationVariation: 1000
}

The default value is (0, 0, 0) (no variation).

See also Node::position and shape.

shape : ParticleShape3D

This property defines a ParticleShape3D for particles attraction. Each particle will be attracted into a random position inside this shape. This is an alternative for defining position and positionVariation. Here is an example how to attract particles into some random point inside sphere by the end of the particles lifeSpan:

Attractor3D {
    position: Qt.vector3d(100, 0, 0)
    shape: ParticleShape3D {
        type: ParticleShape3D.Sphere
        fill: true
    }
}

See also Node::position and positionVariation.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.1/qml-qtquick3d-particles3d-attractor3d.html