Difference between revisions of "Collision start"

From Second Life Wiki
Jump to navigation Jump to search
 
(14 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{LSL_Event|event_id=5|event_delay|event=collision_start
{{Issues/SVC-3306}}{{LSL_Event|event_id=5|event_delay|event=collision_start
|p1_type=integer|p1_name=num_detected|p1_desc
|p1_type=integer|p1_name=num_detected|p1_desc
|event_desc=Triggered when task starts colliding with another task
|event_desc=Triggered when task starts colliding with another task
|constants
|constants
|spec
|spec
|caveats
|caveats=
|examples
* Will not detect collisions with ground.  Use [[land_collision_start]] instead.
* Phantom objects can never receive trigger collision events.
* <code>[[llVolumeDetect]]([[TRUE]])</code> 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.
|examples=<syntaxhighlight lang="lsl2">default
{
    collision_start(integer num)
    {
        llSay(0,"No pushing.");
    }
}</syntaxhighlight>
<syntaxhighlight lang="lsl2">
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);
        }
    }
}
}
</syntaxhighlight>
|helpers
|helpers
|also_header
|also_header
Line 11: Line 46:
{{LSL DefineRow||[[collision_end]]|}}
{{LSL DefineRow||[[collision_end]]|}}
|also_functions={{LSL DefineRow||[[llPassCollisions]]|}}
|also_functions={{LSL DefineRow||[[llPassCollisions]]|}}
{{LSL DefineRow||[[llCollisionFilter]]|}}
{{LSL DefineRow||[[llCollisionSound]]|}}
{{LSL DefineRow||[[llCollisionSprite]]|}}
{{LSL DefineRow||[[llVolumeDetect]]|}}
|also_articles
|also_articles
|also_footer
|also_footer
|notes
|notes
|mode
|mode
|issues
|cat1=Collision
|cat1=Collision
|cat2=Detected
|cat2=Detected
|cat3
|cat3=Collision Events
|cat4
|cat4=Passable
}}
}}

Latest revision as of 19:01, 12 December 2023

Description

Event: collision_start( integer num_detected ){ ; }

Triggered when task starts colliding with another task

• integer num_detected

Caveats

  • 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.


Examples

default
{
    collision_start(integer num)
    {
        llSay(0,"No pushing.");
    }
}
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);
        }
    }
}
}

See Also

Deep Notes

Issues

All Issues

~ Search JIRA for related Issues
   Add enumeration to llPassCollisions() to provide PASS_ALWAYS, PASS_IF_NOT_HANDLED, and PASS_NEVER as explicit options.
(Was: Collisions passed to parent REGARDLESS llPassCollisions(FALSE) in child)

Signature

event void collision_start( integer num_detected );