Difference between revisions of "Virtual Tracking Guide"

From CRIPTWiki
Jump to: navigation, search
Line 41: Line 41:
 
         while(numberDetected > ++i)//skips the first item which suits this application
 
         while(numberDetected > ++i)//skips the first item which suits this application
 
         {
 
         {
            msg += ", " + llDetectedName(i);
+
          msg += ", " + llDetectedPos(0) + llDetectedRot(0);
 
         }
 
         }
 
         llWhisper(0, msg);
 
         llWhisper(0, msg);

Revision as of 04:33, 7 June 2009

realXtend can run LSL scrpit no problem.

Hence, we will be able to use exist LSL command embedding in python to run the command.

The key script that is used:

To do a few things:

  • IF (people within range) then
    • SHOUT to the person about being tracked for the FIRST time
    • Ask for permission to track user.
    • IF (POS/ROT not BOTH EQUAL ZERO) THEN
      • Get Time Stamp
      • Get Position Information
      • Get Rotation Information
      • Output into FILES?

}

Detecting Users in Range

//Setting detection range to 5 meters float range = 5.0;

default {

   //touch state.
   touch_start(integer numberDetected)
   {
        // activates the sensor. Look for avatars (i.e. not moving objects) on all sides of the object
        llSensor("", "", AGENT, range, PI); 
   }

   //When object sensed. Passed on number deteced as parameter
   sensor (integer numberDetected)
   {
       //Notify number and name
       string msg = "Detected " + (string)numberDetected + " avatar(s): " + llDetectedName(0);
       integer i = 0;
       while(numberDetected > ++i)//skips the first item which suits this application
       {
          msg += ", " + llDetectedPos(0) + llDetectedRot(0);
       }
       llWhisper(0, msg);
   }

   no_sensor()
   {
       llWhisper(0, "Nobody is near me at present.");
   }

} ==


integer perm = llGetPermissions(); vector CamVec; rotation CamRot; integer loopTime; //how frequently the loop is run


if (perm & PERMISSION_TRACK_CAMERA) // using & is important! perm is a bitmask!

{
 //Get Camera Position 3D Coordinate
 //Returns a VECTOR
 CamVec = llGetCameraPos();
 //Get Camera Rotation
 //Returns a ROTATION
 CamRot = llGetCameraRot();
 
 //Get User Name
 llRequestAgentData(llDetectedKey(0), DATA_BORN); 
 //Request creation date
   }
   dataserver(key queryid, string data) 
   {
       llSay(0, "You were born on: " + data);
   }

}

}

Source: http://lslwiki.net/lslwiki/wakka.php?wakka=ScriptPermissions