Pages

Sunday, May 23, 2010

Beacon

So Patti wanted a beacon for a radio tower she was making, and I came up with this script. It's a pretty simple script but there's a nifty trick in here I felt like I just *had* to blog about. Here is the beacon script.

float delay = 0.01;
float k = 0;
integer toggle = 0;
default
{
state_entry()
{
llSetTimerEvent(delay);
}
timer(){
if(toggle == 0){
llSetLinkPrimitiveParamsFast(LINK_SET, [25, ALL_SIDES, k]);
k += 0.03; //changing this will change how fast the blink is
if (k >= .5){
toggle = 1;
}
}
if(toggle == 1){
llSetLinkPrimitiveParamsFast(LINK_SET, [25, ALL_SIDES, k]);
k -= 0.03;
if (k <= 0.04){ toggle = 0; } } } }

The neat trick is using llSetLinkPrimitiveParamsFast instead of llSetPrimitiveParams. Check out the video to see why :) The one using llSetLinkPrimitiveParamsFast is on the left. Nice and smooth :)

Oh! The one thing to look out for: you have to be careful changing the speed, do some math and make sure it won't try setting the glow under 0 or over 1. Otherwise you get a super annoying script error D:

0 comments:

Post a Comment