Home |
Add a script
|
||
|---|---|---|---|
| Category: | Contributor: | Description | |
| Door | Anonymous | Door (class Script).lsl | |
Door script
Door (class Script).lsl
Download this script - Please use this link to get this script. If you see all the code on one long line, please use Wordpad or another editor, such as LSLEdit.exe. The .LSL file you will download is an ordinary text file.
1 // CATEGORY:Door 2 // DESCRIPTION:Door script 3 // ARCHIVED BY:Ferd Frederix 4 5 rotation interval; 6 float strength; 7 integer i = 0; 8 default 9 { 10 state_entry() 11 { 13 llMoveToTarget(pos,0.1);//pos is where to move to,,,0.1 is how fast it'll get there 14 llSetStatus(STATUS_PHYSICS,TRUE);//for enabling physics (putting this after the 11movetotarget allows us not to use the 11sleep call 15 strength = llGetMass();//Nada Epoch says,and now, there is a nice c all that will get you the mass without having to use physics equation s to get it 16 } 17 18 touch_start(integer total_number)//everything in the { } below the touch_ start gets done (read) when you touch the object 19 { 20 i++;//Nada Epoch says, i thought origianly you could use the integer total_number, but, that only keeps track of how many avatars touch it , not how many times it gets touched, so to make the counter increment by one put in....same as saying i=i+1 21 interval=llEuler2Rot(<0,0,i*PI/6>);//in the (< and >) the first three components are the axis of rotation and the last one is the actual angle, the vector that is inside the ll Euler2Rot call is a representation of how the object is rotated, so we want it to rotate 0 about the x axis, 0 about the y axis, and 30 degrees about the z, PI is 180 degrees, so PI/6 is 30---that means that we are multipling 30 degrees times the number of times the object has been touched........ ok so what the llEuler2Rot does is it translates a the angles from the euler axis, to a rotation 22 llRotLookAt(interval,(strength)/20,strength/20);//this is telling the object to rotate to the specific rotation "interval" over time "strength/20", with force "strength/2" the scripting doc says that good forcevalues are half of the mass, and good time values are one tenth of the force. The force causes a torque which moves the object to the specified rotation 23 } 24 } 25 // END //