Unofficial LSL Reference

[[functions:llpasscollisions]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

Function: llPassCollisions

llPassCollisions(integer pass)

Indicates whether a child prim in a linkset should let the root know that it has registered a collision.

When a running script in the root prim has one of the collision events (collision_start, collision, collision_end, land_collision_start, land_collision or land_collision_end) active, collisions in any prim of the linkset are registered by the root. As an exception, when a child prim has at least one script that has a collision event and that prim is collided, by default only that prim will register the collision, and the root will not register it. This function allows changing that default, so that both the root and the child can register the collisions, or so that the root won't register them even if the child has no active collision events.

It may be useful e.g. when the script in the root needs to detect whether the object was impacted, no matter where, but one specific prim needs to perform an additional action when it is impacted without excluding the root from doing its job. Or to exclude certain prims from passing collisions to the root, without the need for the root to filter them programmatically.

This function should be called from a script in a child prim, and it affects whether collisions in that child are passed to the root as well as registered by the child. It has no effect if called from the root prim.

Parameters

pass

An integer value indicating whether to pass collisions to the root.

A value of PASS_IF_NOT_HANDLED makes the root register collisions originated in the child prim the script is in, only if none of the scripts in that child has an active collision event. If there is one, the root won't register collisions; only the child will. This is the default value when no script in the child calls llPassCollisions.

A value of PASS_ALWAYS makes the root register collisions from the child prim the script is in, even if a script in that child prim has an active collision event (in which case both will register it).

A value of PASS_NEVER makes the root not register collisions from the child prim the script is in, regardless of the presence or absence of an active collision event in the child.

Notes

  • For an object with llVolumeDetect set to TRUE, this setting has no effect. Only the scripts in the root will receive collision_start and collision_end events coming from any prim in the object, no other script in any other prim will, and no script in any prim will register collision or land_* events.
  • If there is an active collision event in the child, it will always register collisions, regardless of this setting. It only affects whether the root will register collisions.
  • The setting only takes place for the prim where the script is in; it doesn't affect any other prims.
  • This setting is NOT a prim property, it is per script. Deleting or stopping all scripts that changed it from default will cause the effect to cease, and the behaviour to revert to default.
    • If the same script calls this function several times, the one that was executed last prevails. If several scripts in the same prim call it, the one with the highest value takes precedence (PASS_NEVER has precedence over PASS_ALWAYS, which has precedence over PASS_IF_NOT_HANDLED).
  • What does active mean in this case? Collision events are active only if the script is running and in a state that has a collision event. If the script stops running, or if the current state has no collision event, there will be no active collision event for that script.

Short examples

llPassCollisions(PASS_ALWAYS); // Enables collision passing for this prim.

llPassCollisions(PASS_NEVER); // Disables collision passing for this prim.

// Disables collision passing if there's an
// active collision event in a script of this prim.
llPassCollisions(PASS_IF_NOT_HANDLED);

Complete examples

When this simple script is dropped into a child prim that has more scripts, one of them with a collision event, it will let the root know that it has been impacted even if the impact only affects the prim the script is in. If it is removed, and only this prim is impacted, the root will not register the impact.

llPassCollisionss-example.lsl
default
{
    state_entry()
    {
        llPassCollisions(PASS_ALWAYS);
    }
}

See also