dxDrawLine3D | Multi Theft Auto: Wiki Skip to content

dxDrawLine3D

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function draws a 3D line between two points in the 3D world - rendered for one frame. This should be used in conjunction with onClientRender in order to display continuously.

Syntax

dxDrawLine3D ( )

Code Examples

client

This is a small example of creating 3D Line / "Rope" between vehicle and player.

function makeLineAppear()
testVehicle = createVehicle ( 411, 0, 0, 5 ) -- Create our test vehicle.
addEventHandler("onClientRender", root, createLine) -- onClientRender keeps the 3D Line visible.
end
function createLine ( )
x1, y1, z1 = getElementPosition ( testVehicle ) -- Get test vehicles position.
x2, y2, z2 = getElementPosition ( localPlayer ) -- Get local players position.
dxDrawLine3D ( x1, y1, z1, x2, y2, z2, tocolor ( 0, 255, 0, 230 ), 2) -- Create 3D Line between test vehicle and local player.
end
addCommandHandler("line", makeLineAppear)