Attractor3D QML Type

Attracts particles towards a position or a shape. 更多...

import 语句: import QtQuick3D.Particles3D
Since: Qt 6.2
继承: Affector3D

特性

详细描述

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 被使用。

特性文档编制

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.

默认值为 -1 .


durationVariation : int

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

默认值为 0 (no variation).


hideAtEnd : bool

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

默认值为 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
}
									

默认值为 (0, 0, 0) (no variation).

另请参阅 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.


shape : ParticleAbstractShape3D

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
    }
}
											

另请参阅 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.

默认值为 true .