Unofficial LSL Reference

[[functions:llpasscollisions]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

functions:llpasscollisions [2015-01-20 15:56 SLT]
sei VolumeDetect
functions:llpasscollisions [2016-01-02 09:09 SLT] (current)
sei Reordering
Line 6: Line 6:
 </​code>​ </​code>​
  
-Indicates whether a child prim in a linkset should let the root know that it has registered a collision, when there is at least one script in the same child prim that has one of the collision events ([[events/​collision_start]],​ [[events/​collision]],​ [[events/​collision_end]],​ [[events/​land_collision_start]],​ [[events/​land_collision]] or [[events/​land_collision_end]]).+Indicates whether a child prim in a linkset should let the root know that it has registered a collision.
  
-When a script in the root prim has a //collision// event, collisions in the whole object ​are registered by the root in principleHowever, when a child prim has at least one script that has a collision event and that prim is collided, by default only that prim will register the collision, and the root will not register it. This function allows changing that default, so that //both// the root and the child can register the collisions.+When a running ​script in the root prim has one of the collision ​events ($lev[collision_start],​ $lev[collision],​ $lev[collision_end],​ $lev[land_collision_start],​ $lev[land_collision] or $lev[land_collision_end]) active, collisions in any prim of the linkset ​are registered by the root. As an exception, when a child prim has at least one script that has a collision event and that prim is collided, by default only that prim will register the collision, and the root will not register it. This function allows changing that default, so that //both// the root and the child can register the collisions, or so that the root won't register them even if the child has no active collision events.
  
-It may be useful e.g. when the script in the root needs to detect whether the object was impacted, no matter where, but one specific prim needs to perform an additional action when it is impacted.+It may be useful e.g. when the script in the root needs to detect whether the object was impacted, no matter where, but one specific prim needs to perform an additional action when it is impacted ​without excluding the root from doing its job. Or to exclude certain prims from passing collisions to the root, without the need for the root to filter them programmatically. 
 + 
 +This function should be called from a script in a child prim, and it affects whether collisions in that child are passed to the root as well as registered by the child. It has no effect if called from the root prim.
  
 ===== Parameters ===== ===== Parameters =====
  
 === pass === === pass ===
-[[types/​boolean]] value indicating whether to pass collisions to the root.+An $lty[integer] value indicating whether to pass collisions to the root
 + 
 +A value of $lct[PASS_IF_NOT_HANDLED] makes the root register collisions originated in the child prim the script is in, only if none of the scripts in that child has an active collision event. If there is one, the root won't register collisions; only the child will. This is the default value when no script in the child calls $fn[llPassCollisions]. 
 + 
 +A value of $lct[PASS_ALWAYS] makes the root register collisions from the child prim the script is in, even if a script in that child prim has an active collision event (in which case both will register it). 
 + 
 +A value of $lct[PASS_NEVER] makes the root not register collisions from the child prim the script is in, regardless of the presence or absence of an active collision event in the child
  
 ===== Notes ===== ===== Notes =====
  
-  * For an object with [[llVolumeDetect]] set to **TRUE**, this setting has no effect. Only the root will register **collision_start** and **collision_end** events, no other prim will, and no prim will register ​**collision** or **land_`*** events.+  * For an object with $lfn[llVolumeDetect] set to $ct[TRUE], this setting has no effect. Only the scripts in the root will receive $ev[collision_startand $ev[collision_endevents ​coming from any prim in the object, no other script in any other prim will, and no script in any prim will register ​$ev[collisionor $ev[land_`*events
 +  * If there is an active collision event in the child, it will always register collisions, regardless of this setting. It only affects whether the root will register collisions.
   * The setting only takes place for the prim where the script is in; it doesn'​t affect any other prims.   * The setting only takes place for the prim where the script is in; it doesn'​t affect any other prims.
-  * This setting is NOT a prim property, it is per script. ​Deleting or stopping all scripts ​that enabled ​it will cause the effect to cease. It will be enabled while at least one running script ​has it set to **TRUE**If a script that has set this to **TRUE** is set to not running, the flag for that script ​will be disabled while so, and restored when set to running again.+  * $perscript 
 +    * If the same script ​calls this function several times, the one that was executed last prevailsIf several ​scripts ​in the same prim call itthe one with the highest value takes precedence ($ct[PASS_NEVER] ​has precedence over $ct[PASS_ALWAYS],​ which has precedence over $ct[PASS_IF_NOT_HANDLED]). 
 +  * What does //active// mean in this case? Collision events are //active// only if the script ​is running and in a state that has a collision event. If the script stops running, ​or if the current state has no collision event, there will be no active collision event for that script. 
  
 ===== Short examples ===== ===== Short examples =====
  
 <code lsl2> <code lsl2>
-llPassCollisions(TRUE); // Enables collision passing for this prim.+llPassCollisions(PASS_ALWAYS); // Enables ​collision passing for this prim. 
 + 
 +llPassCollisions(PASS_NEVER);​ // Disables ​collision passing for this prim.
  
-llPassCollisions(FALSE); ​// Disables collision passing.+// Disables collision passing ​if there'​s an 
 +// active collision event in a script of this prim. 
 +llPassCollisions(PASS_IF_NOT_HANDLED);​
 </​code>​ </​code>​
  
Line 40: Line 56:
     state_entry()     state_entry()
     {     {
-        llPassCollisions(TRUE);+        llPassCollisions(PASS_ALWAYS);
     }     }
 } }
Line 47: Line 63:
 ===== See also ===== ===== See also =====
  
-  * Collision events: [[events/collision_start]], [[events/collision]], [[events/collision_end]], [[events/land_collision_start]], [[events/land_collision]], [[events/land_collision_end]]. +  * Collision events: ​$lev[collision_start], ​$lev[collision], ​$lev[collision_end], ​$lev[land_collision_start], ​$lev[land_collision], ​$lev[land_collision_end]. 
-  * [[llPassTouches]] is similar but for touch events. +  * $lfn[llPassTouches] is similar but for touch events. 
-  * [[llCollisionFilter]] restricts collisions to only the given UUID or name, or anything but the given UUID or name. +  * $lfn[llCollisionFilter] restricts collisions to only the given UUID or name, or anything but the given UUID or name. 
-  * [[llCollisionSound]] sets the sound the prim should emit when collided.+  * $lfn[llCollisionSound] sets the sound the prim should emit when collided
 +  * $lct[PASS_IF_NOT_HANDLED],​ $lct[PASS_ALWAYS],​ $lct[PASS_NEVER] constants.