ModelParticle3D QML Type

Particle using a Qt Quick 3D Model. More...

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

Particle3D

Properties

Detailed Description

The ModelParticle3D is a logical particle element that creates particles from a Qt Quick 3D Model component.

Property Documentation

delegate : Component

The delegate provides a template defining each object instantiated by the particle.

For example, to allocate 200 red cube particles:

Component {
    id: particleComponent
    Model {
        source: "#Cube"
        scale: Qt.vector3d(0.2, 0.2, 0.2)
        materials: DefaultMaterial { }
    }
}

ModelParticle3D {
    id: particleRed
    delegate: particleComponent
    maxAmount: 200
    color: "#ff0000"
}

instanceTable : Instancing

The instanceTable provides access to the Instancing table of the model particle. ModelParticle3D uses an internal instance table to implement efficient rendering. This table can be applied to the instancing property of models that are not part of the particle system.

It is also possible to use this feature to provide an instancing table without showing any particles. This is done by omitting the delegate property. For example:

ParticleSystem3D {
    id: psystem
    ModelParticle3D {
        id: particleRed
        maxAmount: 200
        color: "#ff0000"
        colorVariation: Qt.vector4d(0.5,0.5,0.5,0.5)
    }

    ParticleEmitter3D {
        particle: particleRed
        velocity: VectorDirection3D {
            direction: Qt.vector3d(-20, 200, 0)
            directionVariation: Qt.vector3d(20, 20, 20)
        }
        particleScale: 0.2
        emitRate: 20
        lifeSpan: 2000
    }
}

Model {
    source: "#Sphere"
    instancing: particleRed.instanceTable
    materials: PrincipledMaterial {
        baseColor: "yellow"
    }
}

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