Don't click here unless you want to be banned.

LSL Wiki : llGetVel

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawling22.us.archive.org
vector llGetVel()

Returns the current velocity of an object in meters/second, relative to the simulator axes.

To find the velocity relative to the direction the object is pointing, try this:
vector global_velocity = llGetVel();
vector local_velocity = global_velocity * llGetRot();

Q: How would one go about calculating the actual speed of an object as a float?
A: Calculate the length (or magnitude) of the velocity vector with llVecMag(llGetVel()).


Functions | Dynamics | Physics
Comments [Hide comments/form]
hey, does this work when the object is attached to an avatar? i dont think it does...
-- ArgusStravinsky (2005-08-14 17:24:09)
It will probably report the velocity of the avatar, but Im not 100% sure - the behavior of the llGet* functions is different when the script is in an attachment and even moreso if the script is in a child prim of an attachment. Ill start working on documenting these scenerios.
-- ChristopherOmega (2005-08-14 17:59:15)
I tried getting the local_velocity as suggested, but got nonsense results.
Change the multiply for a divide to get the right result. (Well it works for me)
-- PatchLamington (2006-01-17 04:41:33)
vector RA = llGetVel() / llGetPos(); !Type Mismatch Error!

Using GetVel with GetPos turn out to be blocked in form of use or actually bugged as of 1.13.1 while it's NOT an type mismatch error.
-- VincentNacon (2007-01-15 05:05:46)
Why are you trying to divide a vector by another vector? That's an operation that doesn't make sense.
-- SeifertSurface (2007-01-22 02:16:55)
Attach a comment to this page: