Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    • CommentAuthorrobotz
    • CommentTimeApr 19th 2008 edited
     
    I must be missing something really obvious here, but I have poured through the documentation and can't find a way to rotate an emitter.

    Say I have a steady() emitter running, I'd like to be able to rotate it based on keypresses. There is a rotate method but that appears to keep the emitter rotating forever (i.e. it isn't under your control once set off)

    Cheers,

    Rich
    • CommentAuthorericr
    • CommentTimeApr 22nd 2008
     
    I believe you do this by rotating the Renderer object that you're using to display the emitter. Something like:

    emitter.rotate(90); // Should rotate the Renderer (and thus the contained Emitter) 90 degrees.

    See the DisplayObject documentation on the rotation property for more.

    That work?
    • CommentAuthorrobotz
    • CommentTimeApr 22nd 2008
     
    Yeah I thought you were going to say this. The problem is that if your emitter is leaving a trail of particles as it moves, and you then rotate the renderer, the entire lot rotates. I've made a small SWF that shows this in action so you can see what I mean (and also see why I don't want this to happen)

    http://www.photonstorm.com/swfs/thrust.swf

    Press space-bar to reset the ship if you fly off the edge (easy to do as I've not yet smoothed things out)

    The trail should remain where it was emitted and not rotate with the renderer. But of course rotating the renderer will do exactly this, so I understand fully WHY it is doing it, just not how to avoid it.

    Cheers,

    Rich
    • CommentAuthorpyiap
    • CommentTimeApr 22nd 2008
     
    This doesn't solve the direct problem, but as an alternative you can adjust the output direction of the emitter. But intuitively rotating the emitter shouldn't rotate the particles drawn along with it.
    • CommentAuthorrobotz
    • CommentTimeApr 23rd 2008
     
    How do you change the output direction of the emitter? I only saw methods that would change the rotation of the particles themselves.

    Right now I'm thinking if this isn't possible I'll have to take the "RotateEmitter" class and tweak it for this specific purpose.

    Seems highly strange Flint can't do it natively. Am still hoping I'm just missing something obvious ...
    • CommentAuthorRichard
    • CommentTimeApr 23rd 2008 edited
     
    Hi, sorry to join you late

    You rotate the emitter with

    emitter.rotation = 90;

    This doesn't move the renderer, and hence doesn't move any existing particles.

    See the docs for more info

    Be sure to use the latest version of Flint or you may run into the bug mentioned here.