llCollisionFilter
void llCollisionFilter(string ObjectName, key ObjectID, integer Accept)Specify an empty string or NULL_KEY for Accept, to not filter on the corresponding parameter.
Parameters
-
ObjectName(string) -
ObjectID(key) -
Accept(integer) - If TRUE, only accept collisions with ObjectName name AND ObjectID (either is optional), otherwise with objects not ObjectName AND ObjectID.
Stop Filtering
Section titled “Stop Filtering”llCollisionFilter("", NULL_KEY, TRUE);Filter Out All Collisions
Section titled “Filter Out All Collisions”llCollisionFilter("", NULL_KEY, FALSE);Detect Collisions with Specific Objects
Section titled “Detect Collisions with Specific Objects”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!"); }}Caveats
Section titled “Caveats”- Any call of
llCollisionFilterin the same event asllVolumeDetectchanging (not just being called, but actually moving from FALSE to TRUE or vice versa) will be disregarded (before or after), if the event handler previously called a user-defined function. See SVC-2490.- You can work around this by calling them in separate events, such as
touch_startandtouch_end.
- You can work around this by calling them in separate events, such as
- 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 if their health reaches 0).
See Also
Section titled “See Also”- llPassCollisions
- llVolumeDetect
- collision_start
- collision
- collision_end