Difference between revisions of "LlVolumeDetect"

From Second Life Wiki
Jump to navigation Jump to search
(this must have changed: moving an object in a setpos loop *will* trigger collision_start/end events against both avs and physical objects)
 
(29 intermediate revisions by 12 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
*Only detects physical objects
{{!}}-
!
! {{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).
*If the volume detecting object is ''not'' physical, it can only detect physical objects and avatars. If the object ''is'' physical, it can detect its collisions with static and [[llSetKeyframedMotion|keyframed motion]] objects as well.
===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=<pre>
|examples=<syntaxhighlight lang="lsl2">default
// by Cory Bjornson
 
default
{
{
state_entry()
    state_entry()
{
    {
llVolumeDetect(TRUE); // Starts llVolumeDetect
        llVolumeDetect(TRUE); // Starts llVolumeDetect
llSetStatus(STATUS_PHANTOM, TRUE); // Makes the Prim Phantom
    }
}
    collision_start(integer total_number)
collision(integer total_number)
    {
{
        llSay(0, "Detected!"); // Tells you when something penetrates the prim
llSay(0, "Detected!"); // Tells you when something penetrates the prim
    }
}
}</syntaxhighlight>
}
</pre>
|helpers
|helpers
|also_functions=
|also_functions=
Line 36: Line 59:
|also_articles
|also_articles
|notes
|notes
|permission
|negative_index
|sort=VolumeDetect
|sort=VolumeDetect
|cat1=Collision
|cat1=Collision
|cat2=Physics
|cat2=Physics
|cat3=Object
|cat3=Object
|cat4
|cat4=Phantom
}}
}}

Latest revision as of 03:24, 11 October 2024

Summary

Function: llVolumeDetect( integer detect );
0.0 Forced Delay
10.0 Energy

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.

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

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 );