[Opensim-dev] Trying to understand llDetected* functions

Mike Mazur mmazur at gmail.com
Tue Jun 17 06:54:05 UTC 2008


Hello,

I'm trying to wrap my head around how llDetected* functions work in
OpenSim.

Here's what I know so far:
- these functions tell you something about either a prim/object or
avatar
- they only apply in certain events (collision{,_start,_end},
touch{,_start,_end} and sensor)
- they take a number as an argument which is an index of the object

I may have some of that mixed up a bit...

I traced through the code for touch_start to try to figure this out.
First, in
OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
line 119 the touch_start function is executed and an llDetectParams
struct is filled in. The arrays in the struct are all 1 in size, and
are filled with some values.

What exactly do these values represent? According to
OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
line 152, _key is "detected key" and _key2 is "owner key". What are
these exactly? The position, velocity, rotation and _string (name)
properties make sense, but the _bool and _int ones don't.

This llDetectParams struct is then assigned to the script, and accessed
in OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs in
functions llDetectedName() (line 554), uuidDetectedKey() (line 595) and
entityDetectedKey() (line 632).

The number argument to each of those functions is used to index the
arrays in the llDetectParams struct (_key, _key2, etc). This array is
always initialized to size 1. Is the number argument ever not 0? Do
those arrays inside the llDetectParams struct ever grow or shrink?

Also, how does the event that is triggered affect the number passed in?
Is it different for collosion_start and touch_start for instance?

Finally, which object is usually referred to in those llDetected*
functions? For example, if I have a box with a script that calls
llDetectedVel() in its touch_start event, will llDetectedVel return the
velocity of the box at the instant it is touched by an avatar? Or maybe
it's the velocity of the avatar?

A lot of questions, but here's hoping someone can clear this up a bit
further.

Thanks,
Mike



More information about the Opensim-dev mailing list