event
Event syntax
collision_start(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
collision_start(integer num_detected){
}Caveats
Section titled “Caveats”- Will not detect collisions with ground. Use
land_collision_startinstead. - Phantom objects can never receive trigger collision events.
llVolumeDetect(TRUE)objects get triggercollision_startandcollision_endbut notcollision() 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.
Examples
Section titled “Examples”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); } } }}Known issues
Section titled “Known issues”-
SVC-3306: Add enumeration to
llPassCollisions() to providePASS_ALWAYS,PASS_IF_NOT_HANDLED, andPASS_NEVERas explicit options.(Was: Collisions passed to parent REGARDLESS
llPassCollisions(FALSE) in child)
See also
Section titled “See also”Functions
Section titled “Functions”Events
Section titled “Events”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.