ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. getWorldModelOnLine

Function

getWorldModelOnLine

New function!Added to Trilogy Hub on 2 Nov 2026.

ClientWorldTrilogy Hub only

Finds a San Andreas map model without collision that the segment passes through: graffiti, car wash brushes, meshes with transparency. processLineOfSight does not see such models because it passes through them. When the segment crosses several of them, the smallest one wins (e.g. graffiti on a building wall). Models with collision are skipped, since processLineOfSight finds those. The result fits removeWorldModel directly.

Syntax

int, float... getWorldModelOnLine(float sx, float sy, float sz, float ex, float ey, float ez)

Arguments

sxfloat
Start X.
syfloat
Start Y.
szfloat
Start Z.
exfloat
End X.
eyfloat
End Y.
ezfloat
End Z.

Returns

model, its x, y, z, rx, ry, rz, LOD model (0 = none) and x, y, z of the point where the segment enters the model; false when nothing was found.

Example

addCommandHandler("graffiti", function()
    local x1, y1, z1, x2, y2, z2 = getCameraMatrix()
    local model, x, y, z = getWorldModelOnLine(x1, y1, z1, x1 + (x2 - x1) * 50, y1 + (y2 - y1) * 50, z1 + (z2 - z1) * 50)
    if model then outputChatBox(("Model %d w %.1f %.1f %.1f"):format(model, x, y, z)) end
end)

See also