|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
02-21-2006 02:54
I have been making explosive bullets recently that have an impact flash effect, which, one would assume, would involve particles. Being a relative youth in SL terms I was brought up on a diet of llParticleSystem. But when I tried to use this to create the impact, I got nothing at all. On the other hand, when I looked through some freebie bullets that I'd picked up, found that some of them used llMakeExplosion, and tried that, it worked almost all the time. Apparently this is a deprecated function, but it works, which is quite an important feature. The bullets are scripted to launch the effect and then die on collision_start - should I sleep them briefly after the effect to let the particles out? Why is llMakeExplosion triggering but the particle system either not going at all, or starting too slowly? I'm puzzled.
|
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
02-21-2006 09:58
From: Ordinal Malaprop I have been making explosive bullets recently that have an impact flash effect, which, one would assume, would involve particles. Being a relative youth in SL terms I was brought up on a diet of llParticleSystem. But when I tried to use this to create the impact, I got nothing at all. On the other hand, when I looked through some freebie bullets that I'd picked up, found that some of them used llMakeExplosion, and tried that, it worked almost all the time. Apparently this is a deprecated function, but it works, which is quite an important feature. The bullets are scripted to launch the effect and then die on collision_start - should I sleep them briefly after the effect to let the particles out? Why is llMakeExplosion triggering but the particle system either not going at all, or starting too slowly? I'm puzzled. Yes, the problem is that the objects are dying too quickly and the particles don't have a chance to escape. No idea why llMakeExplosion works here, but you never know when they'll just remove support for it entirely, so it's best to try to make it work with llParticleSystem(). When I ran into this problem, I solved it like this: in that collision_start, set the thing nonphysical and phantom and set it transparent using llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES) (or llSetAlpha() if it's just a one-prim bullet). Trigger the particle system, and wait as long as is needed before calling llDie().
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
02-21-2006 10:01
It's just one prim, and it's actually full alpha already. (Which is why it needs an impact explosion, otherwise you can't tell what the hell you're doing.) I was thinking of something like that; I'll see what happens then, and how long it takes. There must be a minimum startup time for llParticleSystem and it would be good to find out what that is.
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
02-21-2006 14:00
Hm. Well, I've tried all sorts of combinations of llParticleSystem, llSleep and llDie, and whilst I can get *some* bullets to generate explosions, most of them don't, and llMakeExplosion is still *far* more reliable. Here's some sample bullet code: impact() { // llSetStatus(STATUS_PHYSICS, FALSE); // llSetStatus(STATUS_PHANTOM, TRUE); llParticleSystem([ PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK, PSYS_PART_START_COLOR, <1,1,1>, PSYS_PART_START_ALPHA, 1.0, PSYS_PART_START_SCALE, <0.5,0.5,0>, PSYS_PART_MAX_AGE, 1.0, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, PSYS_SRC_BURST_RATE, 0.1, PSYS_SRC_BURST_PART_COUNT, 10, PSYS_SRC_BURST_SPEED_MIN, 0.5, PSYS_SRC_BURST_SPEED_MAX, 0.5, PSYS_SRC_TEXTURE, "fire" ]); llSleep(1.0); // llMakeExplosion(4, 0.3, 0.5, 0.5, 1.0, "fire", <0,0,0>); llDie(); }
default { on_rez(integer p) { if (p > 0) { llSetDamage(50); llSetTimerEvent(3.0); } }
collision_start(integer n) { impact(); }
land_collision_start(vector pos) { impact(); }
timer() { llDie(); } }
With the particle system there, it works very very intermittently. With the llMakeExplosion, it works pretty much all the time. I've tried all sorts of combinations of particle parameters. I'm a bit stuck. I assume that a different routine is firing here, a more efficient one, when llMakeExplosion is used. Note that I am firing ten or so of these per second. edit: at 80m/s. But it doesn't seem to make a difference whether I fire one or many. In fact, firing many means that the particlesystem fires at least once.
|
|
Candide LeMay
Registered User
Join date: 30 Dec 2004
Posts: 538
|
02-21-2006 15:15
I seem to vaguely remember that the deprecated particle functions are more server side. I can't quite imagine what that means, but probably more aggressive or faster updates. So that could explain why it manages to fire off in the same frame as the collision while llParticleSystem is more lazy.
_____________________
"If Mel Gibson and other cyberspace writers are right, one day the entire internet will be like Second Life." -- geldonyetich
|
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
02-22-2006 09:07
Little known but true fact: if your bullet does damage to someone (that is, if it hits someone in a damage-enabled area), it dies immediately. Presumably, this is so that it doesn't do damage more than once. If that's not the problem, I'd say you need to sleep for longer. I seem to remember needing at least a couple of seconds in there. If you're having the problem that too long a sleep makes too many particles appear, use the PSYS_SRC_MAX_AGE parameter to limit how long the particle system sends particles for. Also, turning off physics and turning on phantom means that sitting there for a good 5-10 seconds isn't really a problem, and that's likely to guarantee particles fly.
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
02-22-2006 09:29
They're not actually hitting people, I'm just firing them at the ground and damageable objects, so it won't be that that's causing the problems.
I'll try even longer sleep periods, but the thing is, if they have to sleep for 5-10 seconds, the explosions are going to appear a bit late really....
|