engineSetModelLODDistance | Multi Theft Auto: Wiki Skip to content

engineSetModelLODDistance

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 sets a custom LOD distance for any object / model ID. This is the distance at which objects of that model ID are switched to their LOD model, or (if there is no LOD model) become invisible.

Syntax

engineSetModelLODDistance ( )

Code Examples

client

This example will set the LOD distance of all script-created objects.

-- Client-side
-- WARNING: Can cause significant lag.
-- Adjusts LOD for all objects.
function setAllObjectsLOD()
-- Get all current objects.
local objects = getElementsByType("object", root, false)
for _, theObject in ipairs(objects) do
local modelID = getElementModel(theObject)
local lodLevel = 325 -- Distance value
-- Set LOD for this model ID.
-- The 'true' enables extended range.
engineSetModelLODDistance(modelID, lodLevel, true)
end
end
-- Command to run the function.
addCommandHandler("setAllObjectsLOD", setAllObjectsLOD)

See Also

Engine Functions
Engine Elements