Don't click here unless you want to be banned.
LSL Wiki :
llSensor
HomePage
::
PageIndex
::
RecentChanges
::
RecentlyCommented
::
UserSettings
:: You are crawling22.us.archive.org
**##llSensor([[string]] [[name]], [[key]] id, [[integer]] type, [[float]] range, [[float]] arc)##** Performs a single [[sensors sensor]] scan for **##[[name]]##** and **##id##** with **##type##** (##[[AGENT]]##, ##[[ACTIVE]]##, ##[[PASSIVE]]##, and/or ##[[SCRIPTED]]##) within **##range##** [[meter meters]] and **##arc##** [[radian radians]] of forward [[vector]] (along x-[[axis]]). [[PI]] radians will search in all directions. **##name##** and **##id##** need no filter. If **##name##** is a [[null]] [[string]] (i.e. "////"), ##llSensor()## will look for [[object objects]] with any name. If **##id##** is the ##[[NULL_KEY]]##, then ##llSensor()## will look for objects with any **##id##**. The limit of **##range##** is 96m. [[value Values]] greater than 96m will be accepted but will be treated as 96m. Note that a ##range## of ##0.0## //does// perform a scan. Compare with ##[[llSensorRepeat]]##, which allows a recurring sensor scan. Raises the ##[[sensor]]## [[event]] when it finds a match, and ##[[no_sensor]]## when it finds none; see ##[[sensor]]## for an example. [[constant Constants]] for **##type##**: |||c **Constant** || **Value** || **Searches for** || || ##[[AGENT]]## || 1 || [[AgentAndAvatar agents]] ([[user users]]) || || ##[[ACTIVE]]## || 2 || [[physical]] objects that are **moving** or objects containing an **active**""<sup>[1]</sup>"" [[script]] || || ##[[PASSIVE]]## || 4 || non-scripted or script is **inactive**""<sup>[2]</sup>"" AND [[nonphysical non-physical]] or, if physical, **not moving** || || ##[[SCRIPTED]]## || 8 || objects containing an **active**""<sup>[3]</sup>"" script ||| ""<sup>[1]</sup>"" **Active**: the script is running and currently doing something. A basic default script that is running may not be active but a script that has a command monitoring, like with ##[[llListen]]##, will always be active. "Active" means more [[sim]] resources are being used. ""<sup>[2]</sup>"" **Inactive**: the script is running and awaiting an event and isn't doing any monitoring (like ##llListen##). Very little sim resources are being used. ""<sup>[3]</sup>"" **Running** scripts may be active or inactive (or, to use [[SL]] lingo, "active" or "passive"). ===Notes=== -Values can be combined to search in multiple categories using [[bitwise bitwise OR (|)]]. For example, ##llSensor("////", [[NULL_KEY]], **AGENT | ACTIVE**, 25, PI)## would search for both agents and physical objects. -After detecting a ##PASSIVE##, ##ACTIVE##, and/or ##SCRIPTED## object, ##[[llDetectedType]]## may be used to check the ##ACTIVE## [[bitflag flag]] (physical) and the ##PASSIVE## flag (non-physical, even if the object contains an active script). The ##SCRIPTED## flag always seems to only detect/apply to active scripts. So it seems ##llSensor## and ##llDetectedType## use the ##PASSIVE## and ##ACTIVE## flags differently. See also [[ObjectType]] for more info about types of objects to detect. -The sensors detect objects only if their [[center]] falls in the detection cone (see below). This makes it harder to use sensors for pathfinding, especially avoiding big objects like walls. -Sensors cannot be used to detect another object's [[child]] prims. -##llSensor## and ##[[llSensorRepeat]]## will not detect the object that contains them. This also applies to [[attachments]]--they won't detect the agent they're attached to unless the sensor script is within a child prim. -The **##name##** parameter is case-sensitive, and will not accept partial names. For example, an object by the name ##Object## will only match when the **##name##** parameter is ##Object##, not ##object## or ##Obj##. -##llSensor## only detects objects within the same Sim. If you need to detect object's positioned in adjacent Sims, use ##[[llSensorRepeat]]##. -The ##SCRIPTED## flag combines strangely with the others, see below. ===Combining SCRIPTED and Other Flags=== Combining the ##SCRIPTED## flag with others can lead to somewhat unintuitive results: -##SCRIPTED## will detect active scripts, or moving physical objects containing a script (active or not). -##AGENT | SCRIPTED## will detect active scripts, or moving physical objects containing a script (active or not); this will **not** detect agents! -##ACTIVE | SCRIPTED## will detect active scripts, or moving physical objects that contain a script (active or not); this will **not** detect moving physical objects that are not scripted. -##PASSIVE | SCRIPTED## will detect active scripts, non-scripted non-physical objects, and physical objects containing a script (active or not); it does **not** detect stationary physical objects that are not scripted. ===Detection Cones (Arc)=== If arc is **x** radians, the //sensor// will look for **x** radians around the object's forward vector (which is the object's //[[local]]// X [[axis]], positive direction), so the actual sweep of the search is **2 * x** radians, and thus [[PI]] radians will search all around the object. In SL terms, the sensor sweep area is a dimpled sphere, with the range defined by the sphere's radius and the arc by the dimple itself. Sensors placed in [[attachments]] will use the direction the avatar is facing as their forward vector. In [[mouselook]], this means that it will be wherever the avatar is looking, while out of mouselook, this means whichever way the avatar is pointing. This does not include where the avatar's head is pointing, or what [[animation]] the avatar is doing, just the direction the avatar would move in if you walked forward. This is the case, regardless of where the object is attached. ===Sensor Visualisation=== ""<table><tr align=center valign=top><td>""This one has ##**arc** = PI / 4## and thus scans a radius of 45 degree around the x-axis: ""<img src="http://www.sdfjkl.org/hosting/lslwiki/sensor_pi_by_four.png">"" [[http://www.sdfjkl.org/hosting/lslwiki/sensor.mpeg video (MPEG, 630KB) of it rotating]] ""</td><td>""For ##**arc** = [[PI_BY_TWO]]## (90 degrees around the x-axis, or a half sphere--hemisphere): ""<img src="http://www.sdfjkl.org/hosting/lslwiki/sensor_pi_by_two.png"></td></tr><tr align=center><td colspan=2>"" And for ##**arc** = [[PI]]## (180 degrees around the x-axis, which means a sphere): ""<img src="http://www.sdfjkl.org/hosting/lslwiki/sensor_pi.png"></td></tr></table>"" **Q:** ''Can I use sensors to detect [[attachment attachments]]?'' **A:** ''No, but you can use ##[[llGetAgentInfo]]## to determine whether or not an avatar has attachments, and whether or not they're scripted, though not how many attachments they have, where they're attached, nor what they are.'' **Q:** ''How can I use a sphere prim to determine sensor radians?'' **A:** ''Using just the Begin dimple, keeping the end 1.0, the math would be:'' radians = PI - (PI * dimple); ---- [[functions Functions]] | [[sensors Sensors]]
Valid XHTML 1.0 Transitional
::
Valid CSS
:: Powered by
WakkaWiki 0.1.2