Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to emit particles from a surface?

Alpha Moonlight
Registered User
Join date: 8 Sep 2005
Posts: 2
08-04-2008 18:55
I want to have particles placed on the entire surface of a prim. I can do it using a flat prim with a surface that is circular by cycling through llParticleScript() with different radii. But how might I do it with a square surface? The math is not an issue, but I can't figure out how I might do it.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-04-2008 21:44
Well, I suppose you could limit the arc as you increase the radius, doing it basically the same way you'd do the circle. You'll need to also hop into each quadrant in turn or have four emitters. Here I'll assume you deal with each quadrant separately in any case:

CODE

if (r < 0.5*sideLength)
{
theta = PI_BY_TWO;
} else
{
theta = PI_BY_TWO-2.0*llAcos(0.5*sideLength/r);
}
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
08-05-2008 03:52
I do this to cover flowerbeds.

1) Use PSYS_SRC_PATTERN_ANGLE

2) Set inner angle and outer angle to zero, do a loop of the particle system using different radii, this gives you a line of particles.

3) Then use llSetPos to move the emitter sideways, repeat step 2.

Continue untll you have covvered your area, then move the emitter back to the start.

It does rely on you been able to cycle through the process fast enough to get back to the start before the particles die.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
08-05-2008 04:41
It seems to me this is a rather resource demanding way to do it for client and server and connection?
_____________________
From Studio Dora
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
08-05-2008 05:46
From: Dora Gustafson
It seems to me this is a rather resource demanding way to do it for client and server and connection?


I don't dispute that, however it was the only way i could see to get the effect I needed.

I think the solution to the problem really depends on the effect that is been sought.

Another way to do it is to set your angle to 45 degrees and have an emitter at each corner of your square orientated towards the centre of the square (or move one emitter around the square).

You still have to vary the radii of the particles.
Alpha Moonlight
Registered User
Join date: 8 Sep 2005
Posts: 2
08-05-2008 19:49
Thanks all for your ideas and comments. I suspect that any way to cover a square prim evenly is going to have a large lag footprint. I was hoping that there would be a friendlier way to do it other than recalculating angles and restarting llParticleScript() so frequently.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
08-08-2008 13:38
you can also try using invisible prims set in a row emmiting particles, and have the particles targeting another row of prims on the other side
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-08-2008 13:59
If it isn't critical that you cover the ENTIRE surface and nothing more, you can always use an inscribing circle or circumscribing circle or something in between.

If you don't care TOO much about them being distributed evenly you can use min and max velocities that would put the particles anywhere from the center to the outer radius in the time it would take an acceleration to bring them to a certain test height above the center of the prim (if you want them to rise, of course). Or put the emitter a certain distance (I believe limited to 10m) below the surface and use a radius/arc that will place them no more than a reasonable distance from the surface upon emission. The latter would also have fewer motion/age issues.

Here is an example of the dropped emitter: Say you have a 10m (on a side) square. The radius of an inscribing circle would be 5m, and the radius of a circumscribing circle would be 5m*llSqrt(2) ~= 7m. Say you choose a circle with radius of 6m for a reasonable approximation of the bounds of the square. Now you place the emitter below the surface (as far as possible so that the curvature is minimized and the particles in the center will not be too far above the surface. We'll choose an emission radius of 10m (which I believe is the maximum). So the emitter will have to be llSqrt(10*10-6*6) = 8m below the surface prim and will want to cover a PSYS_SRC_PATTERN_ANGLE_CONE with an arc between 0.0 and llSin(6/10) = 0.64 radians. Obviously the particles in the center will be 2m above the particles at the edges, which is the best we can do with this type of solution. So hopefully the particles, surface prim, and desired particle behavior (size, motion, age, etc.) works with that.

PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE
PSYS_SRC_BURST_RADIUS, 10.0
PSYS_SRC_ANGLE_BEGIN, 0.0
PSYS_SRC_ANGLE_END, 0.64