Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 2 Support (Qt 5) › Qt Particle Flicker when controlled by JoystickControllerHUD

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8323

    Elisabeth

    Hi all,

    as a followup to https://felgo.com/developers/forums/t/free-particles-influenced-by-entity-rotation/ issue I tried the Qt particle system. While the original issue is fixed now a new problem arose. I want to control the emission rate via a JoystickControllerHUD. For the first few movements of the controller the particles start flickering. Afterwards, the particles are peramenently visible.

    Here is some example code:

    import Felgo 3.0
    import QtQuick 2.0
    import QtQuick.Particles 2.0
    
    GameWindow {
        id: gameWindow
        activeScene: scene
        width: 960
        height: 640
    
        ParticleSystem {
          id: particleSys
          width: gameWindow.width
          height: gameWindow.height
          z: 10
          
          ImageParticle {
    	id: smoke
    	system: particleSys
    	anchors.fill: parent
    	groups: ["A"]
    	source: "img/particle.png"
    	colorVariation: 0
    	color: "#00111111"
          }
          
        }
    
        Scene {
            id: scene
            width: 480
            height: 320
    
    	Rectangle {
    	  id: background
    	  anchors.fill: parent
    	  color: "black"
    	}
    
    	Rectangle {
    	  id: testParticles
    	  x: 200
    	  y: 100
    	  width: 10
    	  height: 3
    	  rotation: 0.0
    	  color: "blue"
    	  visible: true
    
    	  Emitter {
    	    system: particleSys
    	    group: "A"
    
    	    anchors.fill: parent
    
    	    emitRate: 500
    	    lifeSpan: 350
    
    	    acceleration: PointDirection { y: 0; xVariation: 0 }
    	    velocity: PointDirection {x: -300; y: 300}
    	    
    	    size: 24
    	    sizeVariation: 8
    	    endSize: 10
    	  }
    	}
    
    	Rectangle {
    	  id: controlledParticles
    	  x: 400
    	  y: 100
    	  width: 10
    	  height: 3
    	  rotation: 0.0
    	  color: "blue"
    	  visible: true
    	  property double force: 0.0
    
    	  Emitter {
    	    system: particleSys
    	    group: "A"
    
    	    anchors.fill: parent
    
    	    emitRate: 500 * controlledParticles.force
    	    lifeSpan: 350
    
    	    acceleration: PointDirection { y: 0; xVariation: 0 }
    	    velocity: PointDirection {x: -300; y: 300}
    	    
    	    size: 24
    	    sizeVariation: 8
    	    endSize: 10
    	  }
    	}
    
    	JoystickControllerHUD {
    	  id: joystick
    	  anchors.bottom: parent.bottom
    	  anchors.left: parent.left
    	  anchors.bottomMargin: 15
    	  anchors.leftMargin: anchors.bottomMargin
    	  width: 120; height: 120
    
    	  source: "img/joystick_background.png"
    	  thumbSource: "img/joystick_thumb.png"
    
    	  onControllerXPositionChanged: controlledParticles.force = calcForce();
    	  onControllerYPositionChanged: controlledParticles.force = calcForce();
    
    	  function calcForce() {
    	    return Math.sqrt(Math.pow(controllerXPosition, 2.0) + Math.pow(controllerYPosition, 2.0))
    	  }
    	} // joystick
        }// scene
    }
    

     

    Any ideas?

     

    Cheers,

    Thomas

    #8325

    Alex
    Felgo Team

    Hi Thomas,

    did you try to replicate the problem with a pure Qt Project, maybe by changing the force with an animation? If it also occurs, please also post the problem to http://qt-project.org/forums.

    I’ll have a look if i can find any workaround for this.

    Cheers,
    Alex

    #8327

    Alex
    Felgo Team

    Hi again Thomas,

    looks like emitRate and lifeSpan are not completely safe to modify at runtime, I will have a look if this is documented anywhere. However I also tested modifying velocity, size, sizeVariation and endSize, which work fine and you should also be able to create a nice looking rocket boost effect.

    Please let me know if this works for you!

    Cheers,
    Alex

    • This reply was modified 6 years, 9 months ago by  Alex.
    • This reply was modified 6 years, 9 months ago by  Alex.
Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded