# dxDrawLine3D (Client)

> Draws a line in the 3D world for one frame. The line faces the camera.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Screen drawing
- **URL**: https://wiki.mymp.gg/en/dxDrawLine3D

## Syntax

```lua
bool dxDrawLine3D(float startX, startY, startZ, float endX, endY, endZ [, color color = tocolor(255, 255, 255), float width = 1, string|bool stage = postfx])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `startX, startY, startZ` | `float` | Start point in the world. A vec3 also works. |
| `endX, endY, endZ` | `float` | End point in the world. A vec3 also works. |
| `color` | `color` | Colour, a `tocolor` value. *(default: `tocolor(255, 255, 255)`)* |
| `width` | `float` | Thickness. *(default: `1`)* |
| `stage` | `string\|bool` | When to draw: `prefx`, `postfx` or `postgui`, or a boolean (`true` means `postgui`). *(default: `postfx`)* |

## Returns

`true` once the drawing is queued.

## Example

```lua
addEventHandler("onClientRender", root, function()
    local pos = getElementPosition(localPlayer)
    dxDrawLine3D(pos.x, pos.y, pos.z, pos.x, pos.y, pos.z + 3, tocolor(255, 0, 0), 4)
end)
```

### Note

`prefx` and `postfx` draw the same way: only `postgui` changes the layer.

## See also

- [dxDrawLine (Client)](https://wiki.mymp.gg/en/dxDrawLine.md): Draws a 2D line on the screen for one frame.
- [dxDrawMaterialLine3D (Client)](https://wiki.mymp.gg/en/dxDrawMaterialLine3D.md): Draws an image stretched along a line in the 3D world for one frame.
- [onClientRender (Client)](https://wiki.mymp.gg/en/onClientRender.md): Fired every frame, when that frame's dx drawing should be done.
