Difference between revisions of "Move to target"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{LSL Header|ml=*}}
=====Will Move your object to a position=====
=====Will Move your object to a position=====
<pre>
<source lang="lsl2">
// script created by SpiritWolf Chikuwa
// script created by SpiritWolf Chikuwa
//
//
Line 8: Line 9:
// Just please leave this header intact
// Just please leave this header intact
//
//
// Minor changes: (insert your name here and delete this comment if you do any mod of this script, thank you)
// Minor changes:  
// (insert your name here and delete this comment if you do any mod of this script, thank you)
//
//
// Script start here:
// Script start here:
Line 14: Line 16:
default
default
{
{
     state_entry() //i use for this example a "state_entry", so the item move the first second you rez it, but if needed you can change it with something else like "touch_start", it's will move only if you click on it, the alternative of "stat_entry" is "on_rez", the item will move only if rezzed, and now directly when the script will be compiled
     state_entry() // This example uses "state_entry", so the item moves as soon as it is rezzed.
                  // This could be another event such as "touch_start" when it will move only if  
                  // Or use "on_rez" and the item will move only if rezzed, and now directly when
                  // the script is compiled.
     {
     {
         llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE); // of course llSetStatus must be used with physic (we move the item, and phantom, it's not needed, but better if the object must don't collide with something on his way. Also, it's physic, so be carefull, only 31 prims for an item allowed.
         llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE); // This must be used  
         llMoveToTarget(<53.654,199.364,502.542>, 10); // this is waht we want the llMoveToTarget, will move the item to the axes X,Y,Z localy on the curent sim where is the prim, in the 10 on this exampel is the speed, actually, the item will move slowly
// with physics (we move the item, and phantom, it's not needed, but better if the object  
// doesn't collide with anything. Also, it's physics, so be careful, only 32 prims  
// for an item allowed.
         llMoveToTarget(<53.654,199.364,502.542>, 10); // This will move the item to the  
// vector <X,Y,Z> locally on the current sim. "10" is the speed, so the
// object will move slowly.
     }
     }
}
}
</pre>
</source>


[[Category:LSL Examples]]
[[Category:LSL Examples]]

Latest revision as of 17:22, 24 January 2015

Will Move your object to a position
// script created by SpiritWolf Chikuwa
//
// /!\ PUBLIC DOMAIN /!\
// You can Copy/Mod/Trans 
// Please, do not resell this script and give it full perm
// Just please leave this header intact
//
// Minor changes: 
// (insert your name here and delete this comment if you do any mod of this script, thank you)
//
// Script start here:

default
{
    state_entry() // This example uses "state_entry", so the item moves as soon as it is rezzed. 
                  // This could be another event such as "touch_start" when it will move only if 
                  // Or use "on_rez" and the item will move only if rezzed, and now directly when
                  // the script is compiled.
    {
        llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE); // This must be used 
// with physics (we move the item, and phantom, it's not needed, but better if the object 
// doesn't collide with anything. Also, it's physics, so be careful, only 32 prims 
// for an item allowed.
        llMoveToTarget(<53.654,199.364,502.542>, 10); // This will move the item to the 
// vector <X,Y,Z> locally on the current sim. "10" is the speed, so the  
// object will move slowly.
    }
}