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