Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Question about llParticleSystem

Dominic Webb
Differential Engineer
Join date: 1 Feb 2006
Posts: 73
06-20-2006 22:28
I am trying to generate an one-shot particle to go from object a to object b (I have object B's key) when I call a function.

I have done some testing, and either end up with no particles if I call llParticleSystem() several times in (relative) rapid succession. (> 1 times/sec, not including the llParticleSystem([]) call to reset the system)

Has anybody experimented with this, and can give any insight?

Thanks,

- d.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
06-20-2006 22:36
sry not i, but for some reason, "a single drop particle with a target" poped in my mind ?
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
06-20-2006 23:03
Don't use code like this:
llParticleSystem([ stuff ]);
llSleep(2.0);
llParticleSystem([]);

I'm not sure why exactly but I usually don't see particles with that kind of code. Why? Two possible reasons:
1) The object update might not be occuring because the event handler is still paused on your sleep.
2) Because of latency from the sim to your client, by the time the client/viewer gets the object update to start showing particles, suddenly there's a 'turn off particles' following it. The llSleep(2.0) doesn't guarantee there'll be 2 seconds between start and stop on the client side.

#2 there can also apply if you do something like this:
state_entry() {
llParticleSystem([ stuff ]);
llSetTimerEvent(2.0);
}
timer() {
llParticleSystem([]);
}

Again, the turn on command may be delayed more than the turn off command. the 2 seconds wait is on the sim side, not on the client side.

You're better off setting the turn off time INSIDE the particle definition, with the PSYS_SRC_MAX_AGE parameter. That timer is started when particles start being created in the client, independent of when the script in the sim think it said to start the particle display.

Also, make sure your PSYS_SRC_BURST_RATE is LESS than your PSYS_SRC_MAX_AGE or the delay between particle bursts might result in no bursts at all between start and shutoff. :)

Pulling it all together, something like:
CODE

default {
state_entry() {
llParticleSystem( [
PSYS_SRC_BURST_RATE, 0.05,
PSYS_SRC_MAX_LIFE, 1.1, // turn emitter off after 1.1 seconds. less than 1.0 may yield no particles too!
PSYS_SRC_BURST_PART_COUNT, 2, // 2 per burst
PSYS_PART_MAX_LIFE, 5.0, // particles fade after 5sec
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE
] );
llResetTime(); llSetTimerEvent( 3.0 );
}
timer() {
llParticleSystem( [ ] );
// why the timer event? Because when you turn particles off with PSYS_SRC_MAX_LIFE, they aren't 'completely' off. Everytime a player gets close enough to see this prim it will start the particle display again until PSYS_SRC_MAX_LIFE expires again!
}
}


I hope this helps! :D
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources.
Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas.
-
Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
06-20-2006 23:08
And a quick afterthought...

Only one particle display per prim at a time. If you want to combine particle effects either concurrently or in very rapid succession, you may be better off using multiple prims combined with a llMessageLinked in your "control" prim and have particle effects started in the prims within a matching link_message event handler!
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources.
Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas.
-
Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!