salahzar

tour

Dec 8th, 2021 (edited)
983
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. list destinazioni=[
  3.  <203.044815,119.010872, 23.117887>,
  4.  <203.044815,75.823448, 23.117887>,
  5.  <203.313675,47.176334, 23.117887>,
  6.  <157.466354,47.176334, 23.117887>,
  7.  <157.466354,76.147148, 23.117887>,
  8.  <135.841629,76.147148, 23.117887>,
  9.  <100.128853,76.147148, 23.117887>,
  10.  <99.157257,118.852654, 23.117887>,
  11.  <178.305634,119.010872, 23.117887>
  12.  ];
  13. integer index=0;
  14.  
  15. rotation getRotToPointAxisAt(vector axis, vector target) {
  16.     vector mypos=llGetPos();
  17.     target=<target.x,target.y,mypos.z>;
  18.     return llGetRot() * llRotBetween(axis * llGetRot(), target - llGetPos());
  19. }
  20.  
  21. default  
  22. {
  23.     state_entry()
  24.     {
  25.         llSitTarget(<0,0,0.5>,llEuler2Rot(<0,0,PI/2>));
  26.     }
  27.    touch_start(integer count)
  28.    {
  29.        llOwnerSay("Touched");
  30.        llSetTimerEvent(0.1);
  31.        index=0;
  32.     }
  33.     timer(){
  34.        // llOwnerSay("Timer index:"+(string)index);
  35.         llSetTimerEvent(0.0);
  36.        
  37.      
  38.         vector destinazione=llList2Vector(destinazioni,index);
  39.         rotation r=getRotToPointAxisAt(<1,0,0>,destinazione);
  40.         llRotLookAt(r,1.0,10.0);
  41.   // llSetRot(r);
  42.          integer reached;
  43.           do
  44.            {
  45.                float dist = llVecDist(destinazione,llGetPos());
  46.                reached =  dist < 1.3f;
  47.              //  llOwnerSay("Reached: "+(string)reached + " Dist "+(string)dist+" SetPos "+(string)destinazione);
  48.                 llSetPos(destinazione);
  49.                  dist = llVecDist(destinazione,llGetPos());
  50.                 llSleep(0.1);
  51.             }  while(reached==0);
  52.        
  53.         index = index+1;
  54.         if(index>=llGetListLength(destinazioni)){
  55.             index=0;
  56.         }
  57.         llSetTimerEvent(0.01);
  58.         //llSetRot(r1);
  59.    }
  60. }
RAW Paste Data