Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Re-routed here!n Over prims animation

Armstrong Clip
Registered User
Join date: 27 Nov 2007
Posts: 11
11-28-2007 09:36
Hey!

Just joined second life and am very interested in building etc. I built an object and thought I would need to animate it. Turns out I infact apply a texture to it and use a script with it.

Therefore my original question was to make a fountain object.

I have a base, and a sculpted cylinder - which i just now need to 'spout' a water effect. I presume I use some sort of script to communicate with objects which have a texture of water - so they look like water coming out of the center of this cylinder.

Can anybody give me a push in the right direction- am i on the right direction and if so, what would the script look like!

Cheers so much in advance for all your help - I am a Computer Science student at St-Andrews University so plan on picking it up by example if anyone can show.

Thanks so much,

Andy
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
11-28-2007 10:45
One way is to create a water texture animation, another is to use the particle system.

A number of water textures are supplied by LLab in the standard 'Library' folders in your Inventory; search for 'Water'

Two particle mists scripts are also supplied. Search your Inv for 'Waterfall Mist' and 'Waterfall Particle System'.

This will get you thinking in the right direction, but also see these wiki links:

http://rpgstats.com/wiki/index.php?title=LlSetTextureAnim
http://rpgstats.com/wiki/index.php?title=LlParticleSystem

There are many free scripts around that will do almost exactly what you are asking for; someone will almost certainly offer you one! However, I get that you intend working it out & doing it for yourself & the above are not only decent places to start, but will lead you to the answer.

Happy journey! :)
Armstrong Clip
Registered User
Join date: 27 Nov 2007
Posts: 11
11-28-2007 17:25
wow ok cheers.

I am trying to edit this script and i want to use that texture you metnioned as the texture of the partcile effect.

Thus i changed the name of string texture to the one in my inventory folder, but it doesnt work - it just keeps the random colours.

What must i change!?

Thanks :

CODE

// Particle Script 0.5
// Created by Ama Omega
// 3-26-2004

// Mask Flags - set to TRUE to enable
integer glow = FALSE; // Make the particles glow
integer bounce = FALSE; // Make particles bounce on Z plane of object
integer interpColor = TRUE; // Go from start to end color
integer interpSize = TRUE; // Go from start to end size
integer wind = TRUE; // Particles effected by wind
integer followSource = TRUE; // Particles follow the source
integer followVel = TRUE; // Particles turn to velocity direction

// Choose a pattern from the following:
// PSYS_SRC_PATTERN_EXPLODE
// PSYS_SRC_PATTERN_DROP
// PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
// PSYS_SRC_PATTERN_ANGLE_CONE
// PSYS_SRC_PATTERN_ANGLE
integer pattern = PSYS_SRC_PATTERN_DROP;

// Select a target for particles to go towards
// "" for no target, "owner" will follow object owner
// and "self" will target this object
// or put the key of an object for particles to go to
key target = "self";

// Particle paramaters
float age = 1; // Life of each particle
float maxSpeed = 1; // Max speed each particle is spit out at
float minSpeed = 1; // Min speed each particle is spit out at
string texture = "dcab6cc4-172f-e30d-b1d0-f558446f20d4"; // Texture used for particles, default used if blank
float startAlpha = 1; // Start alpha (transparency) value
float endAlpha = 0.1; // End alpha (transparency) value
vector startColor = <0,1,0>; // Start color of particles <R,G,B>
vector endColor = <1,0,0>; // End color of particles <R,G,B> (if interpColor == TRUE)
vector startSize = <1,1,1>; // Start size of particles
vector endSize = <1,0,1>; // End size of particles (if interpSize == TRUE)
vector push = <0,0,0>; // Force pushed on particles

// System paramaters
float rate = 1.5; // How fast (rate) to emit particles
float radius = 1; // Radius to emit particles for BURST pattern
integer count = 1; // How many particles to emit per BURST
float outerAngle = 1.54; // Outer angle for all ANGLE patterns
float innerAngle = 1.55; // Inner angle for all ANGLE patterns
vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source
float life = 0; // Life in seconds for the system to make particles

// Script variables
integer pre = 2; //Adjust the precision of the generated list.

integer flags;
list sys;
integer type;
vector tempVector;
rotation tempRot;
string tempString;
integer i;

string float2String(float in)
{
return llGetSubString((string)in,0,pre - 7);
}

updateParticles()
{
flags = 0;
if (target == "owner") target = llGetOwner();
if (target == "self") target = llGetKey();
if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
if (wind) flags = flags | PSYS_PART_WIND_MASK;
if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
sys = [ PSYS_PART_MAX_AGE,age,
PSYS_PART_FLAGS,flags,
PSYS_PART_START_COLOR, startColor,
PSYS_PART_END_COLOR, endColor,
PSYS_PART_START_SCALE,startSize,
PSYS_PART_END_SCALE,endSize,
PSYS_SRC_PATTERN, pattern,
PSYS_SRC_BURST_RATE,rate,
PSYS_SRC_ACCEL, push,
PSYS_SRC_BURST_PART_COUNT,count,
PSYS_SRC_BURST_RADIUS,radius,
PSYS_SRC_BURST_SPEED_MIN,minSpeed,
PSYS_SRC_BURST_SPEED_MAX,maxSpeed,
PSYS_SRC_TARGET_KEY,target,
PSYS_SRC_INNERANGLE,innerAngle,
PSYS_SRC_OUTERANGLE,outerAngle,
PSYS_SRC_OMEGA, omega,
PSYS_SRC_MAX_AGE, life,
PSYS_SRC_TEXTURE, texture,
PSYS_PART_START_ALPHA, startAlpha,
PSYS_PART_END_ALPHA, endAlpha
];

llParticleSystem(sys);
}

default
{
state_entry()
{
updateParticles();
}

touch_start(integer num)
{
llWhisper(0,"...Generating List...");
for (i=1;i<42;i+=2)
{
type = llGetListEntryType(sys,i);
if(type == TYPE_FLOAT)
{
tempString = float2String(llList2Float(sys,i));
sys = llDeleteSubList(sys,i,i);
sys = llListInsertList(sys,[tempString],i);
}
else if (type == TYPE_VECTOR)
{
tempVector = llList2Vector(sys,i);
tempString = "<" + float2String(tempVector.x) + ","
+ float2String(tempVector.y) + ","
+ float2String(tempVector.z) + ">";
sys = llDeleteSubList(sys,i,i);
sys = llListInsertList(sys,[tempString],i);
}
else if (type == TYPE_ROTATION)
{
tempRot = llList2Rot(sys,i);
tempString = "<" + float2String(tempRot.x) + ","
+ float2String(tempRot.y) + ","
+ float2String(tempRot.z) + ","
+ float2String(tempRot.s) + ">";
sys = llDeleteSubList(sys,i,i);
sys = llListInsertList(sys,[tempString],i);
}
else if (type == TYPE_STRING || type == TYPE_KEY)
{
tempString = "\"" + llList2String(sys,i) + "\"";
sys = llDeleteSubList(sys,i,i);
sys = llListInsertList(sys,[tempString],i);
}
}
sys = llListSort(sys,2,TRUE);
if (target == "") sys = llDeleteSubList(sys,38,39);
else if (target == llGetKey() )
sys = llListInsertList(llDeleteSubList(sys,39,39),["llGetKey()"],39);
else if (target == llGetOwner() )
sys = llListInsertList(llDeleteSubList(sys,39,39),["llGetOwner()"],39);
if (texture == "") sys = llDeleteSubList(sys,24,25);
if (!interpSize) sys = llDeleteSubList(sys,12,13);
if (!interpColor) sys = llDeleteSubList(sys,6,7);

llWhisper(0,"[" + llList2CSV(llList2List(sys,0,21)) + ",");
llWhisper(0,llList2CSV(llList2List(sys,22,-1)) + "]");
}
}
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
11-28-2007 21:45
The texture that is used by the llParticleSystem function is passed to PSYS_SRC_TEXTURE as a UUID.

See the line "PSYS_SRC_TEXTURE, texture,"? This means that PSYS_SRC_TEXTURE wil be passed the value held in variable "texture"

That variable is declared in this line:

string texture = "dcab6cc4-172f-e30d-b1d0-f558446f20d4";

Therefore you need to overwrite the existing UUID with the one that you want to use.

From: Armstrong Clip
i changed the name of string texture to the one in my inventory folder


So if you are saying that you have already done this (ie: "dcab6cc4-172f-e30d-b1d0-f558446f20d4" is the UUID that you entered) then perhaps you need to understand the difference between texture and colour as far as the llParticleSystem is concerned.

Texture is dealt with as above, colour however is dealt with in the lines:

PSYS_PART_START_COLOR, startColor,
PSYS_PART_END_COLOR, endColor,

Far from being "random colours", the colours that you are seeing are declared in the lines:

vector startColor = <0,1,0>;
vector endColor = <1,0,0>;

This means that each particle will start at Green (<0,1,0>;) and end at Red <1,0,0>.

To retain the colour of the actual texture iteself, usually (not always!) you can declare both the startColor and endColor as White (<1,1,1>;)

.... :)
Armstrong Clip
Registered User
Join date: 27 Nov 2007
Posts: 11
11-29-2007 06:41
Brilliant - I am getting closer! I want to however make these particles fall towards the ground. Thus i must set the target to an object below the cylinder i presume. So i make my base and called it base - and set the target = "base" but the particles seem to suck themselves into the cylinder as opposed to the base! I just tried adding you as a friend and you declinded also !:)

Please help!

Andy
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
11-29-2007 07:11
Couple of things....

1) If you are attempting to "target" particles then are two things to bear in mind:

a) PSYS_SRC_TARGET_KEY is a key, but you used "base" which is a string. So on that alone the particles would not target properly.

b) Additionally, in order to target particles, flag PSYS_PART_TARGET_POS_MASK has to be set within PSYS_PART_FLAGS

See /54/9a/223385/1.html for a better understanding of targetting.

2) It could be that you do not need to target at all. Look at pattern PSYS_SRC_PATTERN_DROP (defined as "drop particles at source position with no force";)

http://rpgstats.com/wiki/index.php?title=LlParticleSystem
Armstrong Clip
Registered User
Join date: 27 Nov 2007
Posts: 11
11-29-2007 07:40
I want to drop the particles - but to the cube underneath the source , so the cylinder is where the particles would drop to.

I want the particles to drop to the base of my fountain - a cube whose object name is "base"
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
11-29-2007 08:32
:)...here is a working template that will be nearer to what you are trying to achieve. Pop the script into a prim and water-fountain droplets will cascade down.

You'll have to adjust yourself to get the quantity (PSYS_SRC_BURST_PART_COUNT), size (PSYS_PART_START/END_SCALE), colour (PSYS_PART_START/END_COLOR) and other parameters to your requirements but this is a good, simple starting point.

Rather than "dropping" or "targeting" the particles, what we are doing here is simply defining the angle cone out of which the particles will emit ~ downwards in this case(PSYS_SRC_PATTERN_ANGLE_CONE uses PSYS_SRC_ANGLE_BEGIN/END)

CODE


ParticleStart()
{
llParticleSystem([
PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK| PSYS_PART_INTERP_COLOR_MASK |PSYS_PART_INTERP_SCALE_MASK,
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
PSYS_PART_START_ALPHA, 0.60,
PSYS_PART_END_ALPHA, 0.00,
PSYS_PART_START_COLOR, <0.75,0.75,0.75>,
PSYS_PART_END_COLOR, <0.50,1.00,1.00>,
PSYS_PART_START_SCALE, <0.10,0.10,0.00>,
PSYS_PART_END_SCALE, <0.22,0.22,0.00>,
PSYS_PART_MAX_AGE, 5.00,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.00,0.00, 0.00>,
PSYS_SRC_ANGLE_BEGIN, 2.62,
PSYS_SRC_ANGLE_END, 3.14,
PSYS_SRC_BURST_PART_COUNT, 35,
PSYS_SRC_BURST_RADIUS, 0.05,
PSYS_SRC_BURST_RATE, 0.31,
PSYS_SRC_BURST_SPEED_MIN, 0.83,
PSYS_SRC_BURST_SPEED_MAX, 3.25,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, "eea3f66a-ef39-d37c-f437-757c082bccfc"
]);

}



default
{
state_entry()
{
ParticleStart();
}
}



Another simple and attractive variation to the above is to change PSYS_SRC_ACCEL to <0.00,0.00, -3.00>, PSYS_SRC_ANGLE_BEGIN to 0.00 and PSYS_SRC_ANGLE_END to 0.52.

This sends the particles up vertically but the z-element of PSYS_SRC_ACCEL (-3.00) drags them down again, creating a spouting effect.

Similar effects can be obtained using PSYS_SRC_TARGET_KEY and PSYS_SRC_PATTERN_DROP but the above is probably the easier method. Give it a go! :)