1
0

KanEd-Test07.lsl 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. vector rotationCenter;
  2. default
  3. {
  4. state_entry()
  5. {
  6. llSay( 0, "Hello, Avatar!");
  7. vector startPoint = llGetPos();
  8. rotationCenter = startPoint + < 3, 3, 3 >;
  9. // distance to the point of rotation should probably be a
  10. // function of the max dimension of the object.
  11. }
  12. touch_start(integer total_number)
  13. {
  14. llSay( 0, "Touched." );
  15. // Define a "rotation" of 10 degrees around the z-axis.
  16. rotation Z_15 = llEuler2Rot( < 0, 0, 15 * DEG_TO_RAD > );
  17. integer i;
  18. for( i = 1; i < 100; i++ ) // limit simulation time in case of
  19. { // unexpected behavior.
  20. vector currentPosition = llGetPos();
  21. vector currentOffset = currentPosition - rotationCenter;
  22. // rotate the offset vector in the X-Y plane around the
  23. // distant point of rotation.
  24. vector rotatedOffset = currentOffset * Z_15;
  25. vector newPosition = rotationCenter + rotatedOffset;
  26. llSetPos( newPosition );
  27. }
  28. llSay( 0, "Orbiting stopped" );
  29. }
  30. }