LSL Wiki Mirror 7-7-7 : collision

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
collision(integer num_detected)

Collisions raise this event when an object or avatar collides with the object the script is attached to. The number of detected objects is passed to the script in num_detected. Information on those objects may be gathered via the llDetected* functions. Collisions are also generated if an avatar bumps into or walks on top of an object.

The collision event is not raised when using llVolumeDetect, only collision_start and collision_end are.

Example:
default {
    collision(integer num_detected) {
        llSay(0, llDetectedName(0) + " is currently colliding with me!");
    }
}

collision() and Linked Objects
In a linked object, place a collision event in the root prim to affect the whole object, not just the root prim.
To prevent collisions on a specific child prim from being relayed to the parent, place an empty collision event in the child.
To pass collisions on to the parent from a child with a collision event, use llPassCollisions.

Compare with the collision_start and collision_end events.

Note:
Its important to understand that collision events are triggered when an object collides with the scripted object. Not when the scripted object collides with an object. So the script goes in for example a target and not in a projectile. Very useful of course.

Events | Collisions
There is no comment on this page. [Display comments/form]