Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

smooth/incremental llSetPrimitiveParam changes

Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
11-03-2005 02:35
OK, I can do smooth (incremental) scaling/positioning with some functions:

CODE
default
{
state_entry()
{
vector scale = llGetScale();
integer x;
@loop;
for (x = 0; x < 64; x++)
{
llSetScale(llGetScale() + <.02,0,0>);
}

for (x = 0; x < 64; x++)
{
llSetScale(llGetScale() - <.02,0,0>);
}
jump loop;
}
}


...but I want to do them with llSetPrimitiveParams without having to write out the whole command for each increment:

CODE
default
{
state_entry()
{
@loop;
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<0,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.05,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.1,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.15,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.2,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.25,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.3,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.35,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.4,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.45,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.5,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.45,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.4,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.35,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.3,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.25,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.2,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.15,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.1,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,<.05,0,0>,<0,1,0>,<0,0,0>,1,0,0]);
jump loop;
}
}


I tried sticking a single llSetPrimitiveParams function inside the first script's "for" loop, but can't figure out how to get the variable I want to increment to actually increment, and call llSetPrimitiveParams each increment. :/
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
11-03-2005 02:41
Use an external variable to generate the whole argument:
vector increment = <0.05, 0, 0>;
vector v = ZERO_VECTOR - increment;
and put this in the first for loop:
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,g += increment,<0,1,0>,<0,0,0>,1,0,0]);
and this in the second for loop:
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_TORUS,1,<0,1,0>,0,<0,0,0>,<.05,.05,0>,g -= increment,<0,1,0>,<0,0,0>,1,0,0]);
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
11-03-2005 02:55
Ahh...I had to change "g" to "v" but it works great--thanks!

Now to figure out how to get around the .2-second delay between llSetPrimitiveParams calls... :/ Maybe have 2 scripts inversely phase-synced calling llSetPrimitiveParams? Hmm...
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
11-03-2005 03:09
Now to figure out how to get around the .2-second delay between llSetPrimitiveParams calls... :/ Maybe have 2 scripts inversely phase-synced calling llSetPrimitiveParams? Hmm...
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
11-03-2005 03:28
From: Eep Quirk
Now to figure out how to get around the .2-second delay between llSetPrimitiveParams calls
not recommended - those delays are there for a purpose. doing continual full-prim updates (on a torus!) even just 5 times a second is great if you are trying to build a lag generator :D but otherwise, there might be a better solution. What are you trying to accomplish?
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
11-03-2005 03:40
Just want to do some dynamic sculpture. A client-side llSetPrimitiveParams would be nice...hell, client-side everything would be nice...