engineResetModelLODDistance | Multi Theft Auto: Wiki Skip to content

engineResetModelLODDistance

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 resets the LOD distance for an object / model ID.

Syntax

engineResetModelLODDistance ( )

Code Examples

client

This code will reset all script spawned objects' LOD distances. It also implements a counter which will show how many objects have been affected by this script.

function resetLODs()
local count = 0 -- We add a counter for debug message
for ind, obj in ipairs(getElementsByType("object")) do
-- Get model, and reset it's LOD distance
local model = getElementModel(obj)
engineResetModelLODDistance(model)
-- Add one to counter
count = count + 1
end
outputDebugString("Reset LOD model distance for "..count.." objects", 3)
end
addEventHandler("onClientResourceStart", resourceRoot, resetLODs) -- We run this only when this resource (re)starts

See Also

Engine Functions
Engine Elements