llDetectedPos
function
Function syntax
vector llDetectedPos(integer number// Index of the detection information.
);- Returns
vector- Energy
- 10
Returns the vector position (in region coordinates) of the detected object or avatar specified by number, or <0.0, 0.0, 0.0> if number is not a valid index.
Returns <0.0, 0.0, 0.0> if number is not valid sensed object.
Returns a vector that is the position (in region coordinates) of detected object number.
vector result = llDetectedPos(0);Examples
Section titled “Examples”Example 1
// Get position and distance of toucher
default{ touch_start(integer total_number) { // get the position of the avatar touching this prim vector pos = llDetectedPos(0);
// compute how far away they are float dist = llVecDist(pos, llGetPos() );
llSay(0, "You are " + (string) dist + " metres from me, at coordinates " + (string) pos); }}Example 2
21 collapsed lines
// get name and sim position of Avatars within "say" range
default{ state_entry() { llOwnerSay( "Touch me to get the positions of avatars in 'Say' range" ); }
touch_start( integer vIntTouchCount ) { // Do a one-off sensor sweep over a 20m radius sphere for avatars llSensor( "", "", AGENT, 20, PI ); }
sensor( integer vIntFound ) { integer vIntCounter = 0; //-- loop through all avatars found do { llOwnerSay( llDetectedName( vIntCounter ) // get the position of this detected avatar + (string) llDetectedPos( vIntCounter ) ); } while (++vIntCounter < vIntFound); }7 collapsed lines
// sensor does not detect owner if it's attached no_sensor() { llOwnerSay( "I couldn't find anybody" ); }}Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.