llCollisionFilter
llCollisionFilter(string name,// Specific object name or avatar legacy name to filter for.key id,// Group, avatar, or object UUID to filter by.integer accept// Boolean. IfTRUE, only collisions matching the name and id filters are processed; ifFALSE, matching collisions are excluded.
);- Energy
- 10
Sets the collision filter, exclusively or inclusively.
If accept == TRUE, only accept collisions with objects name AND id (either is optional), otherwise with objects not name AND id
If name or id are blank they are not used to filter incoming messages (or you could say they match everything).
If id is an invalid key or a null key, it is considered blank.
llCollisionFilter("", NULL_KEY, 0);Caveats
Section titled “Caveats”- Any call of
llCollisionFilterin the same event asllVolumeDetectchanging (not just being called, but actually moving fromFALSEtoTRUEor vice versa) will be disregarded (before or after), if the event handler previously called a user-defined function. See svc 2490 - You can get around this by calling them in separate events, such as
touch_startandtouch_end. - Damage caused by
llSetDamagewill still apply to a filtered avatar. - Consequently, the object will immediately die on collision with the avatar. (And kill the avatar their health reaches 0.)
Examples
Section titled “Examples”Example 1
- Stop filtering:
llCollisionFilter("", NULL_KEY, TRUE);Example 2
- Filter out all collisions:
llCollisionFilter("", NULL_KEY, FALSE);This script, placed in a wearable object, detects a collision when the person wearing it collides with an object named “Post”:
- 1st instance :
an object named “Post” has several child prims named “Object” .
The prim named “Post” hits the scripted object or scripted prim , the collision will be detected
- 2nd instance :
an object named “Post” has several child prims named “Object” .
A child prim named “Object” hits the scripted object or scripted prim, the collision will be detected
- 3rd instance :
an object named “Object” has several child prims named “Post” .
A prim named “Post” hits the scripted object or scripted prim, the collision will not be detected
default{ state_entry() { llCollisionFilter("Post","",TRUE); }
collision_start(integer total_number) { llSay(0, "OUCH!"); }}Known issues
Section titled “Known issues”From the issue templates included by the wiki article:
- SVC-2490 (bug): llCollisionFilter completely ignored after call to user-defined function and then a call to llVolumeDetect(TRUE)
See also
Section titled “See also”Functions
Section titled “Functions”Events
Section titled “Events”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.