Difference between revisions of "LlVolumeDetect"

From Second Life Wiki
Jump to navigation Jump to search
m (Replaced old <LSL> block with <source lang="lsl2">)
(29 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{Issues/SVC-2490}}{{Issues/SVC-8141}}{{Issues/SVC-2996}}{{LSL_Function/boolean|detect|default=false}}
|func_id=248|func_sleep=0.0|func_energy=10.0
|func_id=248|func_sleep=0.0|func_energy=10.0
|func=llVolumeDetect|p1_type=integer|p1_name=detect
|func=llVolumeDetect|p1_type=integer|p1_subtype=boolean|p1_name=detect
|func_footnote
|func_footnote=This works much like Phantom, but unlike Phantom, VolumeDetect objects trigger [[collision_start]] and [[collision_end]] events when interpenetrating. Collision events will trigger in any script in the object.
|func_desc=If '''detect''' is {{LSLG|TRUE}}, object becomes phantom but triggers {{LSLG|collision_start}} and {{LSLG|collision_end}} events when other objects start and stop interpenetrating.
|func_desc=If {{LSLP|detect}} is [[TRUE]], VolumeDetect is enabled, physical object and avatars can pass through the object.
|return_text
|return_text
|spec
|spec=
|caveats=*Must be applied to the root prim.
{{{!}} {{Prettytable|style=float:left;}}
*Does not work on attachments.
{{!}}+ Events queued depending on type
{{!}}-
!
! {{Hl2}} {{!}} VolumeDetect
! {{Hl2}} {{!}} Phantom
{{!}}- align="center"
! {{Hl2}} {{!}} Events<br/>Supported
{{!!}} [[collision_start]]<br/><br/>[[collision_end]]
{{!!}} [[land_collision_start]]<br/>[[land_collision]]<br/>[[land_collision_end]]
{{!}}- align="center"
{{!}}}
 
====Differences====
There are a couple differences in how Phantom and VolumeDetect handle collisions; specifically which events are supported and how they handle the ground.
<div style="clear:left;">
======VolumeDetect======
*When physical they fall through the ground with the risk of going off-world.
*[[collision]] events are not triggered
======Phantom======
*When physical they collide with the ground but will not pass through (normal physical object behavior), {{LSLGC|Land Collision|land collision}} events are queued.
</div>
|caveats=
*It can only be applied to the root prim (which will make the entire object VolumeDetect).
*It only detects physical objects and avatars.
*When moving via [[llSetPos]]() by a loop of stages, {{LSLGC|Collision|collision events}} will not trigger.
===Attachments===
'''Note:''' Attachments are not included in the avatar's bounding box. {{LSLGC|Collision|Collision events}} received by attachments are collisions the avatar is having with the world, not collisions the attachment is having. Nothing actually can collide with an attachment{{Footnote|Even if attachments were included in an avatars bounding box, you would not like the outcome, the avatars bounding box is not deformed by animations.}}.
*It is meaningless to enabled on attachments. Attachments cannot collide with anything.
*Attachments do not receive collision events for avatar collisions with VolumeDetect objects.
**Attachments do receive collision events for avatar collisions with non-VolumeDetect, non-phantom objects.
|constants
|constants
|examples
|examples=<source lang="lsl2">default
{
    state_entry()
    {
        llVolumeDetect(TRUE); // Starts llVolumeDetect
    }
    collision_start(integer total_number)
    {
        llSay(0, "Detected!"); // Tells you when something penetrates the prim
    }
}</source>
|helpers
|helpers
|also_functions=
|also_functions=
Line 20: Line 60:
|also_articles
|also_articles
|notes
|notes
|permission
|negative_index
|sort=VolumeDetect
|sort=VolumeDetect
|cat1=Collision
|cat1=Collision
|cat2=Physics
|cat2=Physics
|cat3
|cat3=Object
|cat4
|cat4=Phantom
}}
}}

Revision as of 11:57, 22 January 2015

Summary

Function: llVolumeDetect( integer detect );

If detect is TRUE, VolumeDetect is enabled, physical object and avatars can pass through the object.

• integer detect TRUE enables, FALSE (default) disables

This works much like Phantom, but unlike Phantom, VolumeDetect objects trigger collision_start and collision_end events when interpenetrating. Collision events will trigger in any script in the object.

Specification

Events queued depending on type
VolumeDetect Phantom
Events
Supported
collision_start

collision_end
land_collision_start
land_collision
land_collision_end

Differences

There are a couple differences in how Phantom and VolumeDetect handle collisions; specifically which events are supported and how they handle the ground.

VolumeDetect
  • When physical they fall through the ground with the risk of going off-world.
  • collision events are not triggered
Phantom
  • When physical they collide with the ground but will not pass through (normal physical object behavior), land collision events are queued.

Caveats

Attachments

Note: Attachments are not included in the avatar's bounding box. Collision events received by attachments are collisions the avatar is having with the world, not collisions the attachment is having. Nothing actually can collide with an attachment[1].

  • It is meaningless to enabled on attachments. Attachments cannot collide with anything.
  • Attachments do not receive collision events for avatar collisions with VolumeDetect objects.
    • Attachments do receive collision events for avatar collisions with non-VolumeDetect, non-phantom objects.

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   llCollisionFilter completely ignored after call to user-defined function and then a call to llVolumeDetect(TRUE)
   Volume Detect objects are not always allowing objects to pass through.

Examples

default
{
    state_entry()
    {
        llVolumeDetect(TRUE); // Starts llVolumeDetect
    }
    collision_start(integer total_number)
    {
        llSay(0, "Detected!"); // Tells you when something penetrates the prim
    }
}

See Also

Events

•  collision_start
•  collision
•  collision_end

Functions

•  llPassCollisions

Deep Notes

All Issues

~ Search JIRA for related Issues
   llCollisionFilter completely ignored after call to user-defined function and then a call to llVolumeDetect(TRUE)
   Volume Detect objects are not always allowing objects to pass through.
   llDetectedLinkNumber returns 0 with llVolumeDetect(TRUE)

Footnotes

  1. ^ Even if attachments were included in an avatars bounding box, you would not like the outcome, the avatars bounding box is not deformed by animations.

Signature

function void llVolumeDetect( integer detect );