Skip to content

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.
llCollisionFilter("", NULL_KEY, TRUE);
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!");
}
}
  • Any call of llCollisionFilter in the same event as llVolumeDetect changing (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_start and touch_end.
  • Damage caused by llSetDamage will 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).