Infinite Particle Life

Asked by Erik Formella

If there a way to have particles live forever? i.e they do not disappear after some amount of time.

When creating a Particle Source, is there just a special number to pass for the argument 'particlelife' (like -1) or do I need to modify the class?

I am only generating one particle, by the way, and I would like it to last until I quit pygame.

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
PyIgnition Edit question
Assignee:
David Barker Edit question
Solved by:
David Barker
Solved:
Last query:
Last reply:
Revision history for this message
David Barker (animatinator) said :
#1

I'm afraid there isn't at the moment, as I didn't originally think there would be any use for it - normally that would just mean ever-increasing CPU and memory usage. I suppose it makes sense for a limited number of particles though, so I'll add it in before the 1.0 release. It won't take very long as that was how it behaved before I added in the 'life' feature :P

I'll make it so that passing '-1' makes its life infinite as you suggested, and I'll consider making that the default for when no life is specified (as that probably makes a bit more sense that giving them a life of zero by default).

Thanks for the suggestion.

Revision history for this message
David Barker (animatinator) said :
#2

Update: it's implemented and should be bug-free. Tell me if you find any problems though; I only tested it on a few files.

Revision history for this message
Erik Formella (erik-formella) said :
#3

Is there a special argument I can pass for genspacing so I only get one particle the entire time the program runs?
Without this my program does run into ever-increasing CPU and memory usage.

Thanks

Revision history for this message
Best David Barker (animatinator) said :
#4

As genspacing is keyframeable it wouldn't be possible to allow it to be infinite - for example, if the user were to set it as infinite on frame 1 and then set it to 10 on frame 20, there would be no logical way of determining its value on the frames in between (frame 10, for instance, would have a value halfway between 10 and infinity). The best way of doing what you're trying to achieve would be by keyframing particlesperframe - set it to 1 when you initialise the source, and then create a keyframe for the next frame with it set to 0:

source.CreateKeyframe(frame = source.curframe + 1, particlesperframe = 0)

(Incidentally, 'curframe' is something I forgot to mention in the first version of the manual. Every object has it, and it represents which frame of its life the object in question is at - making it possible to give an object a keyframe a certain number of frames in the future.)

Revision history for this message
Erik Formella (erik-formella) said :
#5

Thanks David Barker, that solved my question.