aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/KanEd-Test16.lsl
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-12 18:00:46 +0000
committerJustin Clarke Casey2009-01-12 18:00:46 +0000
commitfb8faa8336ddb795ccd6840259b06a2608350a57 (patch)
tree1f4977b9918d416602af88709e15aecf9499b969 /bin/assets/ScriptsAssetSet/KanEd-Test16.lsl
parent* Remove FunSLUDP code since this has moved to http://forge.opensimulator.org... (diff)
downloadopensim-SC-fb8faa8336ddb795ccd6840259b06a2608350a57.zip
opensim-SC-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.gz
opensim-SC-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.bz2
opensim-SC-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.xz
* Apply http://opensimulator.org/mantis/view.php?id=2913
* Add the KanEd scripts to the standard library * Thanks Fly-Man-
Diffstat (limited to 'bin/assets/ScriptsAssetSet/KanEd-Test16.lsl')
-rw-r--r--bin/assets/ScriptsAssetSet/KanEd-Test16.lsl66
1 files changed, 66 insertions, 0 deletions
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test16.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test16.lsl
new file mode 100644
index 0000000..536ff19
--- /dev/null
+++ b/bin/assets/ScriptsAssetSet/KanEd-Test16.lsl
@@ -0,0 +1,66 @@
1// This is a script designed to orbit its owner.
2vector startPos;
3vector curPos;
4
5vector offset; // offset from Agent
6integer iteration;
7float rotationRate; // degrees of rotation per iteration
8float sensorInterval; // seconds between sensor scan.
9
10default
11{
12 state_entry()
13 {
14 llOwnerSay( "Hello, Avatar! Touch to start orbiting." );
15 llSetStatus( 1, FALSE ); // turn Physics off.
16 offset = < 2, 2, 1 >;
17 iteration = 0;
18 rotationRate = .5;
19 sensorInterval = .3;
20 }
21
22 touch_start(integer total_number)
23 {
24 startPos = llGetPos();
25 curPos = startPos;
26
27 llSleep( .1 );
28
29 key id = llGetOwner();
30 llSensorRepeat( "", id, AGENT, 96, PI, sensorInterval );
31 }
32
33 sensor(integer total_number)
34 {
35 iteration++;
36
37 if( iteration > 300 )
38 {
39 llResetScript();
40 }
41
42 if( llDetectedOwner( 0 ) == llGetOwner() )
43 { // the detected Agent is my owner.
44 vector position = llDetectedPos(0); // find Owner position.
45
46 // calculate next object position relative both to the Owner's
47 // position and the current time interval counter. That is,
48 // use the iteration counter to define a rotation, multiply
49 // the rotation by the constant offset to get a rotated offset
50 // vector, and add that rotated offset to the current position
51 // to defne the new position.
52
53 float degreeRotation = llRound( rotationRate * iteration ) % 360;
54 rotation Rotation =
55 llEuler2Rot( < 0, 0, degreeRotation * DEG_TO_RAD > );
56 vector rotatedOffset = offset * Rotation;
57 position += rotatedOffset;
58
59 // change the location of the object and save the current (rotated)
60 // offset for use during the next iteration.
61 llSetPos( position );
62 offset = rotatedOffset;
63 }
64 }
65}
66