Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vector objPos;
- default
- {
- touch_end(integer num)
- {
- objPos = llGetPos(); // get the position of the object
- key Toucher = llDetectedKey(0);
- list tmp = llGetObjectDetails(Toucher,[OBJECT_POS]);
- vector avPos = llList2Vector(tmp,0); // get the position of the avatar who clicked the object.
- float distance = llVecDist(objPos,avPos); // get the distance between the object and the avatar.
- if(distance < 10.0 ) // if the distance is less than 10 meters.
- {
- llInstantMessage(Toucher,"You are " + (string)llRound(distance) + " meters from the object");
- // do other stuff
- }
- else // avatars distance is further than 10 meters
- llInstantMessage(Toucher, "You are too far away! Come closer.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement