engineResetModelLODDistance | Multi Theft Auto: Wiki Skip to content

engineResetModelLODDistance

Client-side
Server-side
Shared

Manual Review Required

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.

OOP Syntax Help! I don't understand this!

  • Method: Engine.resetModelLODDistance(...)

Syntax

bool engineResetModelLODDistance ( int model )
Required Arguments
  • model: The model / object ID number you want to reset the LOD distance of.

Returns

  • bool: value

Returns true if the LOD distance was reset to default, or false if the model argument is incorrect, or the LOD distance hasn't been changed.

Code Examples

shared

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