Attractor3D QML Type

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

Import Statement: import QtQuick3D.Particles3D
Since: Qt 6.2
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.


positionsAmount : int

This property defines the amount of possible positions stored within the attractor shape. By default the amount equals the particle count, but a lower amount can be used for a smaller cache. Higher amount can be used for additional randomization.


This property defines a ParticleAbstractShape3D 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.


useCachedPositions : bool

This property defines if the attractor caches possible positions within its shape. Cached positions give less random results but are better for performance.

The default value is true.


© 2024 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.