Skip to content
lsl.devlsl.devLSL Dev

collision

event
Event syntax
collision(
  1. integer num_detected// Total number of detected colliders (usable with llDetected* functions).
) { … }

Triggered continuously while an avatar or another object is colliding with the object containing the script. Passes num_detected, representing the number of detected collisions.

Triggered while task is colliding with another task.

How to use
collision(integer num_detected)
{
}
  • Max number detected is 8.
  • Smallest repeat rate is approximatively 0.13 seconds.
  • Will not detect collisions with ground; use land_collision instead.
  • Will not detect collisions between an avatar sitting on the task and the task itself (avatars are linked to objects they sit on so there is no collision, use the changed event to detect sits).
  • Phantom objects can never receive trigger collision events.
  • llVolumeDetect(TRUE) objects get trigger collision_start and collision_end but not collision() events.
  • A collision with a hovering avatar does not trigger collisions, unless the avatar turns or moves.
  • A collision with a physical object or avatar resting on object does not continuously trigger collisions but for a few times, unless there is movement.
  • Only a physical object will get collision events from colliding with a non-physical object.
Example 1
//Will turn phantom when someone bumps into it if on the list
list access_list = ["Governor Linden"];
default
{
collision(integer num_detected)
{
if(~llListFindList(access_list, (list)llDetectedName(0)))
{
llSetStatus(STATUS_PHANTOM, TRUE);
}
}
}
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.

From the Second Life Wiki

Community documentation adapted from Collision, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.