Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Door Door_class_Script  

Door_class_Script

Door (class Script).lsl

Category: Door
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Door_class_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Door_class_Script_1.lsl
1
2 rotation interval;
3 float strength;
4 integer i = 0;
5 default
6 {
8 {
9 vector pos = llGetPos();//sets pos at where object is made
10 llMoveToTarget(pos,0.1);//pos is where to move to,,,0.1 is how fast it'll get there
11 llSetStatus(STATUS_PHYSICS,TRUE);//for enabling physics (putting this after the 11movetotarget allows us not to use the 11sleep call
12 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
13 }
14
15 touch_start(integer total_number)//everything in the { } below the touch_ start gets done (read) when you touch the object
16 {
17 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
18 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
19 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
20 }
21 }
22 // END //

Back to the Best Free Tools in Second Life and OpenSim.