Difference between revisions of "Collision"

From Second Life Wiki
Jump to navigation Jump to search
(...oops)
m (Replaced <source> with <syntaxhighlight>; minor typo corrected)
 
(19 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{LSL_Event|event_id=6|event_delay|event=collision
{{Issues/SVC-3306}}{{LSL_Event|event_id=6|event_delay|event=collision
|p1_type=integer|p1_name=num_detected|p1_desc
|p1_type=integer|p1_name=num_detected|p1_desc
|event_desc=Triggered while task is colliding with another task
|event_desc=Triggered while task is [[colliding]] with another task.
|constants
|constants
|spec
|spec
|caveats
|caveats=
|examples=<pre>
* Max number detected is 8.
//Will turn phantom when someone bumps into it if on the list
* 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.
* <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.
* 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.
|examples=<syntaxhighlight lang="lsl2">//Will turn phantom when someone bumps into it if on the list
 
list access_list = ["Governor Linden"];
list access_list = ["Governor Linden"];
default{
 
     collision(integer num_detected){
default
         if(llListFindList(access_list, (list)llKey2Name(llDetectedKey(0))) != -1){
{
     collision(integer num_detected)
    {
         if(~llListFindList(access_list, (list)llDetectedName(0)))
        {
             llSetStatus(STATUS_PHANTOM, TRUE);
             llSetStatus(STATUS_PHANTOM, TRUE);
         }
         }
     }
     }
}
}</syntaxhighlight>
</pre>
 
|helpers
|helpers
|also_header
|also_header
Line 30: Line 41:
|also_footer
|also_footer
|notes
|notes
|mode
|issues
|deprecated
|cat1=Collision
|cat1=Collision
|cat2=Detected
|cat2=Detected
|cat3
|cat3=Collision Events
|cat4}}
|cat4=Passable
}}

Latest revision as of 14:29, 24 August 2022

Description

Event: collision( integer num_detected ){ ; }

Triggered while task is colliding with another task.

• integer num_detected

Caveats

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


Examples

//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);
        }
    }
}

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( integer num_detected );