# llGetVel

*LSL function*

```lsl
vector vector llGetVel();
```

- Returns: `vector`
- Energy: 10

Speed is the magnitude of the velocity. Speed is measured in meter per second.

Velocity reported is relative to the [global coordinate frame](https://wiki.secondlife.com/wiki/Viewer_coordinate_frames#global) (the object rotation has no affect on this functions output).

For physic objects , velocity is the velocity of its center of mass [llGetCenterOfMass](/functions/llGetCenterOfMass/) . ( When the object has some torque and has not force , position of the object moves ( it turns ) , but its center of mass is unchanged , so the velocity is null )

Returns a [vector](https://wiki.secondlife.com/wiki/vector) that is the velocity of the object.

```lsl title="How to use" frame="terminal"
vector result = llGetVel();
```

## Examples

<details open>
<summary>Example 1</summary>

```lsl collapse={1-8}
//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;
        }
    }
}//Written by Xaviar Czervik
```

</details>

## Notes

To get the velocity relative the local frame (the direction the object is pointing), divide the output of this function by that of its rotation.

```lsl
vector local_vel = llGetVel() / llGetRot()
```

## See also

### Functions

- [llGetAccel](/functions/llGetAccel/)
- [llGetOmega](/functions/llGetOmega/)
- [llGetForce](/functions/llGetForce/) — Gets the objects force
- [llGetTorque](/functions/llGetTorque/)
- [llGetMass](/functions/llGetMass/)

---

*Source: [LlGetVel](https://wiki.secondlife.com/wiki/LlGetVel) on the Second Life Wiki. Content from the Second Life Wiki article LlGetVel (revision 1194277, 2015-01-22), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llGetVel/
