Advertisement
BlueWall

Untitled

Feb 24th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. vector rotationCenter; // point to rotate around.
  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 < 1000; 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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement