How do I make a stationary image out of particles in LSL?
LSL (Linden Scripting Language) allows for various particle effects using the llParticleSystem function. What are the right parameters to give to that function in order to make a non-moving particle-based image hover over the prim?
(This question was asked in the Script Academy discussion group today. I'm reposting the question and my answer here to help get more LSL users into Stack Overflow.)
Solution 1:
The following script will create a stationary hovering image out of particles, using the first texture found in the contents of the prim.
ParticleImage(string tex, vector scale)
{
list params;
//set texture and size
params += [PSYS_SRC_TEXTURE, tex];
params += [PSYS_PART_START_SCALE, scale];
//make particles follow source
params += [PSYS_PART_FLAGS, PSYS_PART_FOLLOW_SRC_MASK];
//use drop pattern, which has no velocity
params += [PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP];
llParticleSystem(params);
}
default
{
state_entry()
{
//make the prim invisible
llSetAlpha(0.0, ALL_SIDES);
if (llGetInventoryNumber(INVENTORY_TEXTURE))
{
string tex = llGetInventoryName(INVENTORY_TEXTURE, 0);
ParticleImage(tex, <1.0, 1.0, 0.0>);
}
}
}