Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Particle flame - how to control the starting point?

Dendre Benelli
Registered User
Join date: 8 May 2007
Posts: 37
05-13-2008 04:24
Can anyone give me advice on how to control the starting point of a particle flame?

When I put the particle script into the prim the flame goes from the center of the prim rather from the top...

When I change the RADIUS from 0 to some positive number it lifts the flame and brings it to the top of the prim which is great but I see some few particles on the bottom of the prim too on the same distance from the center of the prim as the top particle..Its like its mirroring the top flame...

Does anyone know how to fix it or know any other way to bring the flame particle to the top of the prim without changing RADIUS from 0? Thanks a lot in advance!
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
05-13-2008 09:01
And the other 20-odd parameters besides radius?
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
05-13-2008 11:38
I don't know the answer to your question, but I have seen products with invisible prims containing the particle scripts, for the ostensible purpose of doing what you're asking.

For LOTS of information about particles, go to the Particle Lab! Search ingame. It's a blast. Kudos to its owner/creator, Jopsy Pendragon.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
05-13-2008 12:29
From: Lear Cale
I don't know the answer to your question, but I have seen products with invisible prims containing the particle scripts, for the ostensible purpose of doing what you're asking.

For LOTS of information about particles, go to the Particle Lab! Search ingame. It's a blast. Kudos to its owner/creator, Jopsy Pendragon.


Ditto.. can't say enough about Jopsy's AWESOME Particle Lab. I scripted for a long time, and avoided learning the ins and outs of the particle function for an equally long time. Then, I went to the Particle Lab in Teal, and took about an hour and a half or so, and went from kiosk to kiosk, reading the short, but super easy to understand explanations of the various particle system controls and flags, played with/watched the examples shown, etc. Now, whenever I want to do something with particles, it's no longer a hit and miss with editing a particle script, saving, seeing the changes, repeat. But rather now, I get the idea in my head what I want, go right to the flags, make the changes, and it works as I want it to... :)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
05-28-2008 16:05
another great way is a way i use for 1 prim candless. do this:

Rez a Cylinder, make it the size you want, except make it twice as tall.
Change it to a sphere, dimple the end to 0.500
Change it back to a cylinder.

It should be the size you want, and it shows the center point at the top, That's where the particles will start. You can also try dimpling the sphere to 0.475 and then changing it to a cylinder, this will make the particles start slightly above the candle. (so it doesn't look like the flame is slightly imbedded in the the candle)

**blah i can't type lol, edited to fix that
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
05-29-2008 07:54
Cool, Ruthven -- thanks :)
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
05-29-2008 08:16
Post #7 of /54/ae/255682/1.html gives an example of how to use a parameter to raise the starting point of a candle flame without having the "few particles on the bottom of the prim"

Hard to know for sure without seeing the actual script you are using, but my hunch is that the problem you are having is being caused by the pattern you are using. If you are not already doing so, try using pattern PSYS_SRC_PATTERN_ANGLE

Regardless, the above post gives a particle system scripting solution; you'll just need to change the colour, alpha, texture, speed etc parameters on it to match those which your current script is using. :)
_____________________
http://wiki.secondlife.com/wiki/User:debbie_Trilling
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
05-30-2008 10:26
From: Debbie Trilling
Post #7 of /54/ae/255682/1.html gives an example of how to use a parameter to raise the starting point of a candle flame without having the "few particles on the bottom of the prim"

Hard to know for sure without seeing the actual script you are using, but my hunch is that the problem you are having is being caused by the pattern you are using. If you are not already doing so, try using pattern PSYS_SRC_PATTERN_ANGLE

Regardless, the above post gives a particle system scripting solution; you'll just need to change the colour, alpha, texture, speed etc parameters on it to match those which your current script is using. :)


right, but the problem with that is, if you later resize the prim, you'd have to re-adjust the radius. this is why i use the dimple method. also, just a thought, although i'm not in world to try it, is there some way to get the script to detect the prim size and readjust the radius accordingly?
IE. using some form of code like this for the burst radius: Get Prim Size.Z* 0.5?
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
05-30-2008 11:05
From: Ruthven Willenov
if you later resize the prim, you'd have to re-adjust the radius. this is why i use the dimple method


True; there is alot to be said for the dimple method you suggest. I'd never previously considered that as a solution but it one more option in the toolbox. Thanks :)

The script I posted, however, does answer both OP's original questions and, althou' I didnt post the section of script involved, I do have particle scripts that adjust the radius based on the size of prim.

Depending on the circumstances, I would use llGetPrimitiveParams or llGetScale to determine the prim size, and multiple by an adjustment factor
_____________________
http://wiki.secondlife.com/wiki/User:debbie_Trilling
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
05-30-2008 11:17
From: Ruthven Willenov
IE. using some form of code like this for the burst radius: Get Prim Size.Z* 0.5?

Sure.. The llGetScale function returns a vector equal to the size of the prim.

http://wiki.secondlife.com/wiki/LlGetScale
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
05-31-2008 09:54
From: Meade Paravane
Sure.. The llGetScale function returns a vector equal to the size of the prim.

http://wiki.secondlife.com/wiki/LlGetScale


ok, i used that and i got the scale vector, but of course the radius isn't a vector, not sure how to make the script tell the scale.z to the radius to use it for the calculation
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
05-31-2008 10:21
From: Ruthven Willenov
ok, i used that and i got the scale vector, but of course the radius isn't a vector, not sure how to make the script tell the scale.z to the radius to use it for the calculation

The scale x and y are the diameter of a cylinder and z is the height. You probably want to do something like this to get the radius:

vector size = llGetScale();
float radius;

if (size.x > size.y)
radius = size.y / 2.0;
else
radius = size.x / 2.0;
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
06-02-2008 09:47
From: Sindy Tsure
The scale x and y are the diameter of a cylinder and z is the height. You probably want to do something like this to get the radius:

vector size = llGetScale();
float radius;

if (size.x > size.y)
radius = size.y / 2.0;
else
radius = size.x / 2.0;


ah ok, that looks like what i was looking for, i'll try it when i go in world later, thanks sindy :-)

PS: why does it say size.x, and size.y, when the #i'm looking for is from size.z? i'm still a very newbie scripter, my script skills is limited to editing other scripts to fine tune it to my preferences, so comments in scripts are my friend lol. and thanks again for the help
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
06-02-2008 10:45
From: Ruthven Willenov
PS: why does it say size.x, and size.y, when the #i'm looking for is from size.z? i'm still a very newbie scripter, my script skills is limited to editing other scripts to fine tune it to my preferences, so comments in scripts are my friend lol. and thanks again for the help

I think Sindy is just giving the direct answer to the "radius of a cylinder?" question. For a cylinder, size.z is the length and x & y are the diameter widths - her code snippet does 1/2 the diameter of the smallest width as the radius.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
06-02-2008 10:53
From: Sindy Tsure
The scale x and y are the diameter of a cylinder and z is the height. You probably want to do something like this to get the radius:

vector size = llGetScale();
float radius;

if (size.x > size.y)
radius = size.y / 2.0;
else
radius = size.x / 2.0;


so would i want it to look more like the following?

vector size = llGetScale();
float radius;
radius = size.z / 2.0;
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
06-02-2008 16:40
alright, so i did as i wrote in the previous post, works perfectly! thanks for the help, and i guess i'm learning more than i thought i was lol

edit to add this, hmm, it works for explosions at least, tried it on a cone particle system, didn't seem to do anything
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
06-02-2008 23:37
From: Ruthven Willenov
hmm, it works for explosions at least, tried it on a cone particle system, didn't seem to do anything


The various different particle system parameters are not necessaily transferable between the different patterns, as you have just discovered. An absolutely fabulous effect can quickly degrade into complete junk, just be changing the system pattern. Of course the reverse can be true too, leading to some pleasant surprises.

The explode pattern is not the natural choice for a candle flame. Thats not to say you can not produce a candle flame from an explode pattern...you most definately can. But to do so requires setting other parameters to "contort" and "force" the particles to behave in a somewhat angle-cone-type way. It is little wonder, then, that when you changed from explode to angle-cone that the results were disappointing.

The example below, based on Post #7 of /54/ae/255682/1.html, uses an angle cone pattern and calculates the particle system radius based on the prim size. Note, however, that the multiplier factor is likely to have changed from 2, and this is another possible reason why you are not getting the results you expected

CODE



ParticleStart(Radius)
{
llParticleSystem([
PSYS_PART_FLAGS, 0x103,
PSYS_SRC_PATTERN, 0x004,
PSYS_PART_START_ALPHA, 0.50,
PSYS_PART_END_ALPHA, 0.00,
PSYS_PART_START_COLOR, <1.00,1.00,0.00>,
PSYS_PART_END_COLOR, <1.00,0.00,0.00>,
PSYS_PART_START_SCALE, <0.06,0.12,0.00>,
PSYS_PART_END_SCALE, <0.01,0.01,0.00>,
PSYS_PART_MAX_AGE, 0.70,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.00,0.00,0.04>,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 0.09,
PSYS_SRC_BURST_PART_COUNT, 1,
PSYS_SRC_BURST_RADIUS, Radius,
PSYS_SRC_BURST_RATE, 0.05,
PSYS_SRC_BURST_SPEED_MIN, 0.09,
PSYS_SRC_BURST_SPEED_MAX, 0.13,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, "b708e484-aeef-8cc9-3896-dd661d4e6807"
]);

}
default
{
state_entry()
{
vector PrimSize = llGetScale();
float DerivedRadius = size.z / 2.0;
ParticleStart(DerivedRadius);
}
}
_____________________
http://wiki.secondlife.com/wiki/User:debbie_Trilling
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
07-06-2008 10:50
From: Debbie Trilling


}
default
{
state_entry()
{
vector PrimSize = llGetScale();
float DerivedRadius = size.z / 2.0;
ParticleStart(DerivedRadius);
}
}
[/php]

actually, i used a similar code like this but i put it in the particle state, (particle uses on off switch, and automatically updates if you've changed the prim size when you re-activate the particles.) i know you can also write in somewhere so that the script detects if the prim has been changed and resets the script or whatever setting needs to be changed for you, but not sure about how to go about doing that. that would be usefull so you don't have to manually update the script each time you want to change the prim size, or if you're putting it in a mod product but have the script no-mod.