Rotating a Particle Emitter
  • MindJuiceMindJuice January 2
    Posts: 14

    Hi guys,


    I have a particle system emitter that shoots particles to the left.  I would like to rotate the emitter so that it can shoot the particles in any direction I choose.

    I tried setting the rotation property of the emitter, but all that does is set the rotation of the emitted particle, which is not what I want.

    Basically what I want is for the velocityX and velocityY of a particle to be rotated by the angle of the emitter so they shoot out in a different direction based on emitter.rotation.

    Is it possible to do this?

    Thanks,


    Ken
  • JohnJohn January 2
    Posts: 52

    Yes, it is a little confusing in terms of particle designer; for now it is called 'angleOfCreationRange', and it is defined in the particle designer initializer. There isn't really an easy way to access this yet, so this is an 'unsafe' way of doing it; obviously you could do checks to make sure the variable exists first before accessing it:

    ((PKDesignerInitializer *)[effect.initializers objectAtIndex:0])->angleOfCreationRange = PKRangeMakeFromVariance(M_PI / 4.0f, 0.0f);

    Note that the angle is in radians.

    I hope this helps, at least for now.

    Pixelwave Team - Lead Developer
    // Clean before you build, otherwise the dust will get in.
  • MindJuiceMindJuice January 7
    Posts: 14

    The property "initializers" is @protected, so I added a setAngleOfCreationRange() method to PXParticleEmitter with your suggested line of code above.


    I wanted to adjust the speed of the particles to match the speed of the background scrolling too, so I also added setSpeedRange() to PXParticleEmitter using a similar line of code.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter Sign In with OpenID

Sign In Apply for Membership

In this Discussion

Top Posters