diff options
Diffstat (limited to 'bin/assets/ScriptsAssetSet/KanEd-Test07.lsl')
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test07.lsl | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test07.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test07.lsl new file mode 100644 index 0000000..a1258f9 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test07.lsl | |||
@@ -0,0 +1,38 @@ | |||
1 | vector rotationCenter; | ||
2 | |||
3 | default | ||
4 | { | ||
5 | state_entry() | ||
6 | { | ||
7 | llSay( 0, "Hello, Avatar!"); | ||
8 | vector startPoint = llGetPos(); | ||
9 | rotationCenter = startPoint + < 3, 3, 3 >; | ||
10 | // distance to the point of rotation should probably be a | ||
11 | // function of the max dimension of the object. | ||
12 | } | ||
13 | |||
14 | touch_start(integer total_number) | ||
15 | { | ||
16 | llSay( 0, "Touched." ); | ||
17 | |||
18 | // Define a "rotation" of 10 degrees around the z-axis. | ||
19 | rotation Z_15 = llEuler2Rot( < 0, 0, 15 * DEG_TO_RAD > ); | ||
20 | |||
21 | integer i; | ||
22 | for( i = 1; i < 100; i++ ) // limit simulation time in case of | ||
23 | { // unexpected behavior. | ||
24 | vector currentPosition = llGetPos(); | ||
25 | |||
26 | vector currentOffset = currentPosition - rotationCenter; | ||
27 | |||
28 | // rotate the offset vector in the X-Y plane around the | ||
29 | // distant point of rotation. | ||
30 | vector rotatedOffset = currentOffset * Z_15; | ||
31 | vector newPosition = rotationCenter + rotatedOffset; | ||
32 | |||
33 | llSetPos( newPosition ); | ||
34 | } | ||
35 | llSay( 0, "Orbiting stopped" ); | ||
36 | } | ||
37 | } | ||
38 | |||