Skip to content
lsl.devlsl.devLSL Dev

collision_start

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

Triggered when an avatar or another object first begins colliding with the object containing the script. Passes num_detected, representing the number of detected collisions.

Triggered when task starts colliding with another task

How to use
collision_start(integer num_detected)
{
}
  • Will not detect collisions with ground. Use land_collision_start instead.
  • 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.
  • Only a physical object will get collision events from colliding with a non-physical object.
Example 1
default
{
collision_start(integer num)
{
llSay(0,"No pushing.");
}
}
Example 2
5 collapsed lines
list DetectedAvatars = [];
default
{
state_entry()
{
llVolumeDetect(TRUE); // Enable detection of people colliding with object....
}
collision_start(integer detected)
{
integer index = llListFindList(DetectedAvatars, [llDetectedKey(0)]);
if (index == -1)
{
llInstantMessage(llDetectedKey(0), " Welcome to the Community");
DetectedAvatars = llListInsertList(DetectedAvatars, [llDetectedKey(0)], -1);
if (llGetListLength(DetectedAvatars) == 2)
{
DetectedAvatars = llDeleteSubList(DetectedAvatars, 1, 2);
}
}
}
}
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 start, 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.