|
Epilort Byrne
Registered User
Join date: 6 Jul 2004
Posts: 30
|
07-13-2007 13:15
Hi. I am trying to create a spotlight effect for a light I made. The light is simply a semi transparent cone that is colored yellow. I have a square platform with four of these lights on its corners. There is a statue in the middle and I want to make them "shine" in random directions on that statue. At airports, movie premieres and other big events they have these lights and move randomly around in the sky, but I need these to move around randomly within a certain range so they shine on different parts of the statue. How do I do this?
Thanks, Epilort Byrne
|
|
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
07-13-2007 16:05
Hopefully, you're only changing the rotation of each light. If so, there's an easy solution. First, create a simple script to llOwnerSay() the rotation of each light on touch... Using that script, manually rotate the spotlight to hilight parts of the statue... touch to get the rotation. The goal is to build a list of rotations for each spotlight.
Repeat for all four lights. You can then discard the llOwnerSay utility script and start on a new script. The new script will take a list of the rotations for that light and randomly pick an index every timer cycle.
rotation SPOT_ROTS = [<rot1>, <rot2>, <etc>]; integer total;
default { state_entry() { total = llGetListLength(); llSetTimerEvent(2.0); } timer() { llSetRot(llList2Rot(SPOT_ROTS, (integer)llFrand(total))); } }
|
|
Epilort Byrne
Registered User
Join date: 6 Jul 2004
Posts: 30
|
07-13-2007 19:11
Yes this works nicely but is there any way to get a smooth, even transition, I suppose I could just use a list of rotations but I suspect it will still be choppy. I don't know how to explain this geometrically but if I were to shine a flashlight on a wall and spin it with my wrists, I could control the size of the circle on the wall.
|
|
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
07-13-2007 20:01
you could try doing something like llRotLookAt(...) or llLookAt(..) to have it rotate within a certain time frame
_____________________
My SLExchange shopTypos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not. The function is working perfectly fine. It's just not working the way you wanted it to work.
|
|
Naryu Yue
Interrupted?
Join date: 23 Jul 2007
Posts: 15
|
ok, heres a smooth spotlight effect
07-23-2007 13:03
//script by Naryu Yue //this is a script I made for my holo-like lights... it´s a very smooth rotation you can use //it if you want. The rotation is limited, and the direction of rotation is changeable. It also //istens for ON and OFF commands, issued by someone on "authorized people" list.
integer toggle;
//start and end Angles limit the rotation //to invert rotation (left-to-right, right-to-left) just switch sign on start and end angles float startAngle = -35; float endAngle = 35;
integer step = 5; integer counter;
rotation currRot;
list authorized = []; //set here the names of the authorized avatars to command the lights
go() { llSetRot(llAxisAngle2Rot(<-1,-1,0>,startAngle * DEG_TO_RAD)); llSetTimerEvent(1.0); }
stop() { llResetScript(); }
default { state_entry() { llListen(0, "", NULL_KEY, "ON"); llListen(0, "", NULL_KEY, "OFF"); toggle = TRUE; }
timer() { if (toggle) { for (counter = 0; counter < 15; counter++) { llSetRot(llGetRot()*llAxisAngle2Rot(<-1,-1,0>,step * DEG_TO_RAD));
} toggle = FALSE; } else { for (counter = 0; counter < 15; counter++) { llSetRot(llGetRot()/llAxisAngle2Rot(<-1,-1,0>,step * DEG_TO_RAD)); } toggle = TRUE; } } listen( integer channel, string name, key id, string message ) { if (llListFindList(authorized, [llKey2Name(id)]) != -1) { if (message == "ON") { llSay(0,"Ativando"); go(); } else { if (message == "OFF") { llSay(0,"Desativando"); stop(); } } } } }
anyway... can someone help me with a weird question? the objects where i put this script often appears out of position. Very out of position! They tendo to climb thin air. I don't think someone has been moving it, because I have the objects on absolutely no permissions. It's not locked down though, once locking the object will make the script stop working. Can it be the rotation makes the object go slowly out of place?
|
|
HarleyMC Homewood
Registered User
Join date: 31 Mar 2007
Posts: 15
|
Authorised avatars??
08-05-2007 06:51
From: Naryu Yue //script by Naryu Yue It also //istens for ON and OFF commands, issued by someone on "authorized people" list.
integer toggle;
//start and end Angles limit the rotation //to invert rotation (left-to-right, right-to-left) just switch sign on start and end angles float startAngle = -35; float endAngle = 35;
integer step = 5; integer counter;
rotation currRot;
list authorized = []; //set here the names of the authorized avatars to command the lights
go() i'm sure it's a nice script - if I could work out how to authorise persons, typing in avatar names doesn't seem to work, neither does OWNER. Thought I go witha simpler version that is always on but got too lost in the commands on off business to get a workable script out of this. does anyone have any suggestions?
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
08-05-2007 11:14
Inside the script, change this line:
list authorized = [];
to this
list authorized =["avatar name"];
or
list authorized =["avatar one","avatar two","avatar three"];
for multiply avatars to be authorized
also, make sure you type ON or OFF in upper case, or change the listen control so that the words "ON" and "OFF" are "on" and "off"
|
|
HarleyMC Homewood
Registered User
Join date: 31 Mar 2007
Posts: 15
|
thank you
08-05-2007 23:43
thank you I'll give it atry the """" bit had eluded me  )
|