Difference between revisions of "LlCollisionFilter"

From Second Life Wiki
Jump to navigation Jump to search
m (fixe)
Line 17: Line 17:
Filter out all collisions:
Filter out all collisions:
<lsl>llCollisionFilter("", NULL_KEY, FALSE);</lsl>
<lsl>llCollisionFilter("", NULL_KEY, FALSE);</lsl>
== Complete script whit llcollisionfilter ==
<lsl>
//The stair sound script. Make a sculpted oe prim stair make sound when an avatar go up on down on It.
//MathieuBC Noel scripter and freebie maker. Don't erase that part when you use this script
key    id  ; 
default
{
    state_entry()
    {
    }
    collision_start(integer total_number)  //It's write colision start to notofy the computer that     
                                            //the next command line are going to work when the       
                                            //object detect an colision.
    {   
        if (AGENT)                          //The computer star to read the command line when It's
                                            //an avatar colide on this.
          {
          llGetAgentInfo( id );            //Agent key is get by the object.
          llCollisionFilter("", id, TRUE);  //You have an colision only whit an agant whit the key                 
                                            //taken by the object.
          llSensorRepeat( "", id, AGENT, 3, PI,.7 ); //The sensor is sctivate each .7 second
            }
          else
            { 
              state off ;                    //If It's not an AGENT colision the computer must use   
                                              //the state off command line well below in the script
                                              //sheet.
              }
                }
              collision_end(integer total_number)
    {   
          llSensorRemove();                    //When the object did not detect an colision, the
                                                //sensor is remove
            }
            sensor(integer  total_number)      //This is the sensor action when It's activate whit
                                                //the above command line in the begin of this sheet.
    {
        if(AGENT_WALKING)                      //If the sensor detect in his radius an Agent
                                                //walking and running please dothe command line
                                                //below.
            llPlaySound("steps_on_wooden_stairs", 1.0);  //Play the sound name I put in the
                                                        //inventory object. You can also copy and 
                                                        //past the UUID of the soung between the two
                                                        //" .
        else                                            //Otherwise (else), if the agent do nothing
                                                        //read orther command line.
            llStopSound();                              //Stop sound
}
          land_collision_start(vector pos)              //If the object have an land colision follow
                                                        //the lines below.
{      llStopSound();                       
        llSensorRemove();                                //Remove the repeat sensor.
}
        }
      state off                                        //This is the state off apear in the beginig 
                                                        //of the script.                                 
{
    state_entry()
    {
    llStopSound();                                      //Stop sound                 
    llCollisionFilter("", id, FALSE);                    //Stop the filtering of collision identity 
                                                        //and UIID detection to choose to have and 
                                                        //colision whit It.
state default ;                                              //Retun to the begening of the script                                               
}
    }
</lsl>
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 12:44, 27 August 2009

Summary

Function: llCollisionFilter( string name, key id, integer accept );
0.0 Forced Delay
10.0 Energy

Sets the collision filter, exclusively or inclusively.

• string name
• key id
• integer accept

if accept == TRUE, only accept collisions with objects name and id (either is optional), otherwise with objects not name or id

Examples

Stop filtering: <lsl>llCollisionFilter("", NULL_KEY, TRUE);</lsl> Filter out all collisions: <lsl>llCollisionFilter("", NULL_KEY, FALSE);</lsl>

Complete script whit llcollisionfilter

<lsl> //The stair sound script. Make a sculpted oe prim stair make sound when an avatar go up on down on It. //MathieuBC Noel scripter and freebie maker. Don't erase that part when you use this script key id  ;

default {

   state_entry()
   {

   }

    collision_start(integer total_number)   //It's write colision start to notofy the computer that       
                                            //the next command line are going to work when the        
                                            //object detect an colision.

   {    
        if (AGENT)                          //The computer star to read the command line when It's 
                                            //an avatar colide on this.
         {
          llGetAgentInfo( id );             //Agent key is get by the object.

          llCollisionFilter("", id, TRUE);  //You have an colision only whit an agant whit the key                  
                                            //taken by the object.

          llSensorRepeat( "", id, AGENT, 3, PI,.7 ); //The sensor is sctivate each .7 second 

            } 
          else
            {  
              state off ;                    //If It's not an AGENT colision the computer must use     
                                             //the state off command line well below in the script 
                                             //sheet.

              }
               }
              collision_end(integer total_number) 
   {    
          llSensorRemove();                    //When the object did not detect an colision, the 
                                               //sensor is remove 
            } 



            sensor(integer  total_number)       //This is the sensor action when It's activate whit 
                                                //the above command line in the begin of this sheet.
   { 


        if(AGENT_WALKING)                       //If the sensor detect in his radius an Agent 
                                                //walking and running please dothe command line 
                                                //below.

           llPlaySound("steps_on_wooden_stairs", 1.0);  //Play the sound name I put in the 
                                                        //inventory object. You can also copy and   
                                                        //past the UUID of the soung between the two 
                                                        //" .

       else                                             //Otherwise (else), if the agent do nothing 
                                                        //read orther command line.


            llStopSound();                              //Stop sound


} 
          land_collision_start(vector pos)              //If the object have an land colision follow 
                                                        //the lines below.

{ llStopSound();

       llSensorRemove();                                //Remove the repeat sensor.

}

       } 

      state off                                         //This is the state off apear in the beginig  
                                                        //of the script.                                   

{

   state_entry()
   {

   llStopSound();                                       //Stop sound                  
   llCollisionFilter("", id, FALSE);                    //Stop the filtering of collision identity   
                                                        //and UIID detection to choose to have and  
                                                        //colision whit It. 


state default ; //Retun to the begening of the script


}

   }
</lsl>

See Also

Events

•  collision_start
•  collision
•  collision_end

Functions

•  llPassCollisions
•  llVolumeDetect

Deep Notes

Signature

function void llCollisionFilter( string name, key id, integer accept );