Forums

OverviewV-Play 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
    V-Play 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
    V-Play 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.

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