Brainache
Member
|
Particles
Hey there...
Question on particles: Trying to get a particle system to fade out then get removed... I am setting the reborn = false, and the fade out works correctly.. but the particle never gets triggered for deletion ( ie: update returns false)
If I call particle.del() instead of setting reborn to false, the particle gets removed, but doesnt fade out...
How do I get the particle to fade out then get deleted...
Thanks!
|
|
12-12-2009 01:56 PM |
|
Seba
Member
|
RE: Particles
You have to set:
Quote:b_particle[i].life_total=1.5;
And update like that:
Quote: REPA(b_particle)
{
if(!b_particle[i].update())
{
b_particle.remove(i);
}
}
|
|
12-12-2009 02:00 PM |
|
Brainache
Member
|
RE: Particles
hmm. when i set the life total... it causes the particle to reset... I cant do it on particle creation, because the particle is attached to a projectile... so the particle needs to be alive as long as the projectile is... then after the projectile collides... begin to fade out...
Setting the life total upon projectile collision works close.. except that the particle resets before fading out...
Any suggestions
|
|
12-12-2009 04:25 PM |
|
Brainache
Member
|
RE: Particles
Another particle problem... what is the best way to delete the particle?
When I create a projectile, I add the particle to a particle list... then when I want to remove the particle, I am doing this:
void remove(Particles *part)
{
int idx = particles.index(part);
if (idx >= 0)
{
particles[idx].del();
particles.remove(idx);
//part->del();
}
}
Which seems to work... but causes an "unable to allocate x bytes" error message from time to time...
Thanks!
|
|
12-13-2009 03:07 PM |
|
Esenthel
Administrator
|
RE: Particles
for your first issue please also set 'particle.fade_in=0' this will solve your problem
for the second issue I think you have an error in your codes.
if you reference the particle objects by pointers then you need to use Meml or Memx container
|
|
12-14-2009 06:41 PM |
|
Seba
Member
|
RE: Particles
If i have model and i make particle in ME. If i save it i can load it with model or i have to add it like extra object?
|
|
12-16-2009 11:45 PM |
|
Brainache
Member
|
RE: Particles
I dont believe particles save with meshes... you'll need to add them...
|
|
12-17-2009 12:15 AM |
|