Difference between revisions of "LlGetVel"

From Second Life Wiki
Jump to navigation Jump to search
m (fixe)
(Added example.)
Line 9: Line 9:
|caveats
|caveats
|constants
|constants
|examples
|examples=
<lsl>
//A very simple (and not very effective) way of keeping a physical object in place.
//If you ever want to actually stop an object, use llMoveToTarget(llGetPos(), .1)
default {
    state_entry() {
          vector spd;
          while (1 == 1) // Go forever
              if (llVecMag(spd = llGetVel()) > .001) { //We're accelerating...
                    llApplyImpulse(-spd, 0) //Slow us down.
              }
          }    }
} Code by Xaviar Czervik
</lsl>
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 11:08, 8 February 2008

Summary

Function: vector llGetVel( );
0.0 Forced Delay
10.0 Energy

Returns a vector that is the velocity.

Examples

<lsl> //A very simple (and not very effective) way of keeping a physical object in place. //If you ever want to actually stop an object, use llMoveToTarget(llGetPos(), .1) default {

    state_entry() {
         vector spd;
         while (1 == 1) // Go forever
              if (llVecMag(spd = llGetVel()) > .001) { //We're accelerating...
                   llApplyImpulse(-spd, 0) //Slow us down.
              }
         }     }

} Code by Xaviar Czervik

</lsl>

See Also

Functions

•  llGetAccel
•  llGetOmega

Deep Notes

Signature

function vector llGetVel();