- Documentation
- Client functions
- getWorldModelOnLine
Function
getWorldModelOnLine
New function!Added to Trilogy Hub on 2 Nov 2026.
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
processLineOfSightFinds the first obstacle on the segment between two points and returns the hit details. On the client it asks the game (terrain, buildings, objects, cars, peds, collisions from .col files) and returns plenty of data: hit point, element, surface normal, material, lighting, body or vehicle part, and on request the map object model with its position. Each call waits about one game frame; while the world is still loading (loading screen) it returnsfalseat once. On the server it uses a simplified model (element spheres, no terrain or buildings).removeWorldModelStores the removal of San Andreas map objects with a given model within a sphere of the given radius. Can be called many times; each call adds an entry. If called before the game has loaded its models (e.g. while the player joins), it waits and applies once loading finishes.