Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Need Help: Wander affector - some particles never wiggle, and xVariance seems to do nothing
Qt 6.11 is out! See what's new in the release blog

Need Help: Wander affector - some particles never wiggle, and xVariance seems to do nothing

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 92 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 4 Offline
    4 Offline
    4w8c2c
    wrote last edited by
    #1

    Hi all,
    I'm playing with the Wander affector in QtQuick.Particles and I'm stuck on something weird.
    My setup: a simple rocket emitter shooting particles straight up from the bottom of the window. I added a Wander on the rocket group to make them drift left and right a bit, like they're wobbling in the wind. I also added a TrailEmitter so I can see the actual path each particle takes.
    Here's the code.

    import QtQuick 2.5
    import QtQuick.Particles 2.0
    
    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Rocket Wander Test")
    
        Rectangle {
            id: root
            width: parent.width
            height: parent.height
            color: "#1F1F1F"
    
            ParticleSystem {
                id: particleSystem
            }
    
            ImageParticle {
                id: trailPainter
                system: particleSystem
                groups: ['trail']
                source: "assets/particle.png"
                color: "cyan"
                alpha: 0.6
            }
    
            ImageParticle {
                id: rocketPainter
                system: particleSystem
                groups: ['rocket']
                source: "assets/rocket.png"
                entryEffect: ImageParticle.Fade
            }
    
            Emitter {
                id: rocketEmitter
                anchors.bottom: parent.bottom
                width: parent.width; height: 40
                system: particleSystem
                group: 'rocket'
                emitRate: 2
                maximumEmitted: 4
                lifeSpan: 5200
                lifeSpanVariation: 400
                size: 64
                velocity: AngleDirection { angle: 270; magnitude: 150; magnitudeVariation: 10 }
            }
    
            TrailEmitter {
                id: pathTrail
                system: particleSystem
                group: 'trail'
                follow: 'rocket'
                emitRatePerParticle: 30
                lifeSpan: 6000
                size: 6
                sizeVariation: 1
                velocity: PointDirection { x: 0; y: 0 }
            }
    
            Wander {
                groups: ['rocket']
                anchors.fill: parent
                system: particleSystem
                affectedParameter: Wander.Position
                pace: 150
                xVariance: 1200
                yVariance: 0
            }
        }
    }
    

    I expected that, every rocket wiggles left and right by some amount, and turning xVariance up makes the wiggle wider. But instead this is what I'm seeing:

    Some rockets wiggle, some come out as a perfectly straight line, even though they all go through the same Wander block. I attached a screenshot showing this (some straight trails, some wavy trails, side by side).

    I ran the same test four times, only changing xVariance each time (500, then 700, then 900, then 1200). The wiggle width looked exactly the same every single time. Changing xVariance did not seem to make the wiggle any wider or narrower.
    The only thing that changing xVariance from 500 to 700 to 900 to 1200 affected was how much of the x axis range it covered, not the wiggle amplitude itself.

    I tried making the Wander region smaller and moving it (using anchors.horizontalCenter and a fixed width instead of anchors.fill: parent). With this setup, nothing wiggled at all, no matter what I set xVariance to (I tried 30 and 500, both flat lines). I also attached a screenshot of this test.

    So right now it looks like, xVariance does not seem to control how wide the wiggle is.
    Whether a rocket wiggles at all seems to depend on something else, maybe where it spawns, or where the Wander box sits on screen, but I have not been able to pin down what exactly.

    Has anyone run into this before? Is there something about how Wander picks which particles to affect, or how xVariance is supposed to work, that I am missing? Any pointers to the actual source or a working example would help a lot.
    Thanks in advance.

    x500.png

    x700.png

    x900.png

    x1200.png

    1 Reply Last reply
    1

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved