Forums

OverviewV-Play 2 Support (Qt 5) › Particle Question

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #8598

    Senad

    I’m having some trouble with particles,

    When i set the particle x and y to the player.x and player.y , the already created particles follow the x and y positions of the player forming a straight line. Id like the already created particles to flow freely and not follow the x and y positions of the player.

    I have set the positionType: ParticleVPlayBase.Free but i still get the same result.

     

    Here is my particle element:

         x: player.x
         y: player.y
         sourcePositionVariance: Qt.point(0,0)
    
         // Particle configuration properties
         maxParticles: 38
         particleLifespan: 1.5
         particleLifespanVariance: 0.2
         startParticleSize: 2
         startParticleSizeVariance: 2
         finishParticleSize: 25
         finishParticleSizeVariance: 10
         rotation: 180
         angleVariance: 0
         rotationStart: 0
         rotationStartVariance: 0
         rotationEnd: 0
         rotationEndVariance: 0
    
         // Emitter Behavior
         emitterType: 0
         duration: 0
         positionType: ParticleVPlayBase.Free
    
         // Gravity Mode (Gravity + Tangential Accel + Radial Accel)
         gravity: Qt.point(0,0)
         speed: 85
         speedVariance: 2
         tangentialAcceleration: 0
         tangentialAccelVariance: 0
         radialAcceleration: 0
         radialAccelVariance: 0
    
         // Radiation Mode (circular movement)
         minRadius: 0
         minRadiusVariance: 0
         maxRadius: 0
         maxRadiusVariance: 0
         rotatePerSecond: 0
         rotatePerSecondVariance: 0
    
         // Appearance
         startColor: Qt.rgba(0.76, 0.25, 0.12, 1)
         startColorVariance: Qt.rgba(0, 0, 0, 0)
         finishColor: Qt.rgba(0, 0, 0, 1)
         finishColorVariance: Qt.rgba(0,0,0,0)
         textureFileName: "../../assets/img/particleFire_32.png"
    
    
         // start when finished loading
         autoStart: true

     

     

    Thanks

     

    #8599

    Martin

    I’m just a beginner, but let me guess: this is because you are “suffering from” property propagation: whenever the player.x changes, so this passes on to the particle.

    Rather than statically declaring

    x: player.x
    y: player.y

    I think you need something like:

    onConstructed: {
        x = player.x
        y = player.y
    }

    so that the assignment happens only once at the beginning.

    I’m not 100% sure that “onConstructed” is the correct valid method for a “particle” … I remember seeing “onConstructed” being used somewhere, but I can’t quickly find it again now.   Hopefully this is enough to point you in a productive direction though, at least until the experts arrive…

    Martin

     

    #8600

    Martin

    Actually, reading here I think that it was onCompleted() that I was thinking of.   Strangely, it seems like (according to my editor) EntityBase doesn’t have onCompleted(), only onEntityCreated().   I guess the latter would also be OK.

     

    #8602

    Senad

    Thanks for the reply, I didn’t try this yet but wouldn’t this render the emitter into a static position? (i would like the emitter to follow the x/y of the player while the particles float freely)

    • This reply was modified 3 years, 6 months ago by  senadb.
    #8604

    Martin

    You’re right – I misunderstood.

    I will have the same problem soon, so I will experiment a bit…

    #8605

    Martin

    I fired up the ParticleEditor demo, by using Qt Creator “Open Project” to open

    …/V-PlaySDK/Examples/V-Play/demos/ParticleEditor/ParticleEditor.pro

    (fantastic demo app, by the way)

    I used the third screen of the right hand menu to change the behaviour to “1”.

    Then I went to the next screen of the right hand menu to change the X and Y of the emitter, and sure enough the particles follow the position of the emitter.

    And in fact, no matter what I tried (combinations of particle mode and type and particle speed) the particles position appears to be tied to the position of the emitter.

    Maybe this is a limitation of the particle system: in order to operate efficiently, the particles aren’t part of the game world, so they can’t be “cut loose” from the emitter?

     

    • This reply was modified 3 years, 6 months ago by  GreenAsJade.
    #8613

    Senad

    I ended up using QtQuick.Particles 2.0, works great..

     

     

    #8701

    Alex
    V-Play Team

    Hi,

    I just saw that we didn’t document one very important property of the ParticleVPlay item, which is the target property.

    If you use ParticleVPlayBase.Free then we need to prevent movements of the emitting item to influence the particles. To do this, the ParticleVPlay item needs to know the item that is moving, to get it’s x,y and rotation values in order to eliminate them. By default, the target is the parent item of the ParticleVPlay item. In your case, this is not the player I guess? So you would need to set the target property to player.

    And the second thing you are experiencing is indeed a bug, and is caused by using the rotation property. This one is not working at the moment, you need to use the angle property instead, which is unfortunately also not documented… I’m very sorry for that.

    Cheers,
    Alex

    • This reply was modified 3 years, 6 months ago by  Alex.
    • This reply was modified 3 years, 6 months ago by  Alex.
    #8809

    Martin

    It works for me.   The appended emmitter works fine…

     

      ParticleVPlay {
          id: hotfootEmitter
    
          running: hasHotfoot
    
          anchors.horizontalCenter: parent.horizontalCenter
          anchors.top: parent.bottom
    
          // Particle configuration properties
          maxParticles: 32
          particleLifespan: 0.9
          particleLifespanVariance: 0.2
          startParticleSize: 7
          startParticleSizeVariance: 2
          finishParticleSize: 0
          angle: 90
          angleVariance: 132
    
          // Emitter Behavior
          emitterType: ParticleVPlayBase.Gravity
          duration: 0
          positionType: ParticleVPlayBase.Free
          target: parent
          sourcePositionVariance: Qt.point(0,10)
    
          gravity: Qt.point(0,1)
          speed: 85
          speedVariance: 2
    
          // Appearance
          startColor: "#fcfb13"
          finishColor: "#ce0b0b"
          textureFileName: "../../assets/img/particleFire_32.png"
        }
    

     

    #15654

    V-Play User

    Try setting the “Position Type” to 0 in the Emitter Behaviour tab of the right panel.

Viewing 10 posts - 1 through 10 (of 10 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support