Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 1 Support › Particles affected by gravity of scene

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4315

    Philipp

    We have a particle effect and want it to be affected by the gravity of the PhysicsWorld of the scene.

    How can we achieve this?

    #4316

    Christian
    Felgo Team

    Hi,

    you could just connect the gravity property of the particle with the gravity property of PhysicsWorld, like in the following example:

    Scene {
    PhysicsWorld {
    id: physicsWorld
    }

    Particle {
    gravity: physicsWorld.gravity
    }
    }

     
    Cheers, Chris

    #4336

    Philipp

    I did as a fact try that myself and I tought it doesn’t work. Well and I just figured out that it works indeed, but the particles seem to be very light. Meaning, they are not affected by the gravity as much as I would like them to be. With a short lifespan they seem to don’t even move at all

    #4337

    Christian
    Felgo Team

    Hi,

    you can just multiply the gravity of the Particle element like the following:

    Scene {
     PhysicsWorld {
      id: physicsWorld
     }
    
     Particle {
      gravity: physicsWorld.gravity*10
     }
    }

     

    Or like that if you want to scale x and y independently:

    gravity: Qt.point(physicsWorld.gravity.x*10, physicsWorld.gravity.y*20)

    Cheers, Chris

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

RSS feed for this thread

You must be logged in to reply to this topic.