Sprite particle scales and rotations?

Is there no way to have sprite particles rotate during their lifetime?
There seems to be an AnimAngle option but it doesnt seem to do anything.
Also, is there no way to have different sprites have random scales?

Also I still havent found out how to have particle effects “die” after some period of time without having some sprites, points, etc remaining floating in mid air.

All things you said should be possible.

def createExplosion(self):
	explo = loader.loadModel("../game/explosions/explo_palettized.egg")
	explo.find('**/+SequenceNode').node().play()
	explo.setBillboardPointEye()
	dur = explo.find('**/+SequenceNode').node().getNumFrames() / explo.find('**/+SequenceNode').node().getFrameRate()
	exploseq = Sequence(Wait(dur),Func(explo.removeNode)).start()

And rotating:

def createRotatingExplosion(self):
	explo = loader.loadModel("../game/explosions/explo_palettized.egg")
	explo.find('**/+SequenceNode').node().play()
	explo.setBillboardPointEye()
	dur = explo.find('**/+SequenceNode').node().getNumFrames() / explo.find('**/+SequenceNode').node().getFrameRate()
	explorot = LerpHprInterval(explo, dur, (0,0,120), (0,0,0))
	exploseq = Sequence(explorot,Func(explo.removeNode)).start()

… where the .egg file is a series of images that you egg-texture-carded.

Hi

Are you talking about particle system ?
If so then use ZSpinParticleFactory for the Factory and SpriteParticleRenderer for the Renderer.

Make sure that you setAnimAngleFlag to true on the sprite renderer. I believe this is how the python names it, my code is in C++, and for some reason I can’t see any of the python classes on the web site…
I had a problem getting particles to rotate and found that I forgot to set this true.

Scaling also has flags to turn on (setXScaleFlag and setYScaleFlag) and is done with the initial and final x and y scale set functions ex: setInitialXScale(value); there is no spread setting for scaling but you can control the spread on the emitter (amplitude and amplitude spread).

The life of the particle is controlled by setting the factory setLifespanBase and setLifespanSpread.

Yeah, paricles aren’t documented very well. I tried to help on that: panda3d.org/manual/index.php/User:Anon
but I find the purpose of some options very difficult to find out.
And yes, I use the Particle Panel for making a particle effect. It is very daunting to do it by code before you get the results you want.
Anyway, in Python the Panda names should be the same only in camelCase.

Youre right about ZSpin, but im not sure what you mean on scale spread, thers no “amplitude”, just “velocities”.

There is a Lifespan option in the System menu, “Age in seconds at which the system (vs. Particles) should die”. Default is 0, which means the particle generator won’t die. It doesnt seem to work untill you enable “System grows older” checkbutton, and if you do you get what I described: the particles after the given time just freeze, they don’t disappear. is it not the same for you?

Another question I have: can you have the individual particles not be relative to the particle system (so they wont follow it)? i.e. think of a monster with a particle effect on its head for doing flame. I think Ive seen that done in games.

oh okay, particle panel, looking at that again I see they call the amplitude and amplitude spread:
Velocity Multiplier and Velocity Spread. C++ uses emitter->set_amplitude(value) and emitter->set_amplitude_spread(value) this works with the offset velocity vector or the explicit velocity vector as a multiplier. You can put in a unit vector and then use the multiplier as a magnitude, works like a force.

I don’t touch that system grows older button, yeah it stops everything, maybe it’s a bug or I just don’t know how to use the panel… But under the Factory tab is the Life Span and Spread that is suppose to control when the particles are removed.

Hmm, not sure about particles not being relative to the system; maybe you can make it look like it’s not by how the particles move away, like add a force that is opposite the direction of travel so that it trails away from the character emitting the sprites, and then I guess they fade away too…

I’ve added a horizontal force to smoke sprites coming out of a chimney to simulate the wind.

tim

But how can this be used to add randomness to particle scales?

Thats the Lifespan of individual particles. Im talking about the particle system as whole.

But how do you know at what direction and at what speed it travels?
A better example would be a rain particle effect. Imagine attaching it to your car node.

The velocity multipier and spread just sends the particles away at different rates, so maybe it can appear that there are particles of different scales, the scales can change over time from the initial scale to the final scale. Not sure if that’s really what you want.

To stop the system from emitting more particles then you do have to use that set_system_lifespan function on the particle system class, I don’t think the particle panel is working right for that.

I was thinking about getting the direction vector of your character make it point the opposit direction and multiply it by the same speed*dt as your character is moving then put that vector in a force node or add it to the emitter offset force setOffsetForce. I guess all this has to be done in code and not in the panel.

no, I just want to have randomness on the sizes of particles.

I could do the direction thing with code, but it would be alot more work than if panda allowed to have particles positionally relative to the world.
Also this wouldnt work for rain…