Don't click here unless you want to be banned.

LSL Wiki : Collisions

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are


In SL, a collision occurs when two objects make contact (impact, collide) in-world. Phantom objects do not cause collision events unless llVolumeDetect is used, except in the case of land collisions.

A script can have a stack/heap collision.

Attachments will not trigger collision events if the object itself collides with something else. However, if the avatar collides with the object, the collision event is triggered.

Note: collisons are not "touches", which is when a user clicks ("touches") on the object with their mouse cursor.

Function Purpose
llCollisionFilter Limits collisions to a specific name or key, so only collisions with a certain object(s) or agent(s) will trigger them.
llCollisionSound Replaces or disables the sound the object makes when something collides with it.
llCollisionSprite Replaces or disables the particles the object emits when something collides with it.
llDetectedGrab Returns the direction the detected object is being dragged in.
llDetectedGroup Returns TRUE if the detected agent/object is in the same active user group.
llDetectedKey Returns the key of the detected agent/object.
llDetectedLinkNumber Returns the link number that triggered the collison/touch event.
llDetectedName Returns the name of the detected agent/object.
llDetectedOwner Returns the key of the detected agent/object's owner.
llDetectedPos Returns the position of the detected agent/object.
llDetectedRot Returns the rotation of the detected agent/object.
llDetectedType Returns the detected object type (AGENT, ACTIVE, PASSIVE, SCRIPTED).
llDetectedVel Returns the velocity of the detected agent/object.
llPassCollisions In a linked object, passes collison events from a child prim containing a collision event to the parent.
llVolumeDetect Turns the object phantom and triggers collision_start and collision_end events when an agent/object intersects it.

Event Triggered
collision while agent/object is colliding with the object containing the script
collision_start when agent/object starts colliding with with the object containing the script
collision_end when agent/object stops colliding with with the object containing the script
land_collision while the object containing the script is colliding with the ground
land_collision_start when the object containing the script starts colliding with the ground
land_collision_end when the object containing the script stops colliding with the ground

Example Script:

//By James Benedek
//Collision Detection
        collision(integer num_detected)
         if (llDetectedType(0) & AGENT)
         llSay(0,"I Collided with an Avatar!");
         if (llDetectedType(0) & ACTIVE)
         llSay(0,"I Collided with a Physical Object!");
         if (llDetectedType(0) & SCRIPTED)
         llSay(0,"I Collided with a Scripted Object!");
        if (llDetectedType(0) & PASSIVE)
         llSay(0,"I Collided with a Object!");
        land_collision(vector pos)
        llSay(0,"I Collided With Land!");


Functions | Events | Detection | Physics
There are 5 comments on this page. [Display comments/form]