Difference between revisions of "LlGetVel"
Jump to navigation
Jump to search
m |
|||
Line 3: | Line 3: | ||
|sort=GetVel | |sort=GetVel | ||
|func=llGetVel|return_type=vector | |func=llGetVel|return_type=vector | ||
|func_footnote | |func_footnote=Velocity reported is relative to the [[Viewer coordinate frames#Global|global coordinate frame]] (the object rotation has no affect on this functions output). | ||
|func_desc | |func_desc | ||
|return_text=that is the velocity of the object | |return_text=that is the velocity of the object. | ||
|spec | |spec | ||
|caveats | |caveats | ||
Line 28: | Line 28: | ||
|also_events | |also_events | ||
|also_articles | |also_articles | ||
|notes | |notes=To get the velocity relative the local frame (the direction the object is pointing), multiply the output of this function with that of it's rotation. | ||
<lsl>vector local_vel = llGetVel() * llGetRot()</lsl> | |||
|cat1=Physics | |cat1=Physics | ||
|cat2=Vehicle | |cat2=Vehicle |
Revision as of 15:45, 8 February 2008
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: vector llGetVel( );77 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns a vector that is the velocity of the object.
Velocity reported is relative to the global coordinate frame (the object rotation has no affect on this functions output).
Caveats
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; {@loop; if (llVecMag(spd = llGetVel()) > .001) { //We're accelerating... llApplyImpulse(-spd, 0) //Slow us down. } jump loop;} }}//Code by Xaviar Czervik</lsl>
Notes
To get the velocity relative the local frame (the direction the object is pointing), multiply the output of this function with that of it's rotation. <lsl>vector local_vel = llGetVel() * llGetRot()</lsl>
See Also
Functions
• | llGetAccel | |||
• | llGetOmega |