clockwerk-opensim-config – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | eva | 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 |