- Documentation
- Shared functions
- getModelBoundingBox
Function
getModelBoundingBox
Returns a model's dimensions without creating an element: the minimum and maximum x, y, z relative to its centre (from the game's collision) and the radius. The server asks a player's game, so inside async it waits up to 1.5 s and remembers the result.
Syntax
float, float, float, float, float, float, float getModelBoundingBox(int model)Arguments
modelint- The model id.
Returns
minX, minY, minZ, maxX, maxY, maxZ, radius; false for an unknown model or with no players (server).
Example
local minX, minY, minZ, maxX, maxY, maxZ = getModelBoundingBox(411)
outputChatBox(("Długość: %.2f m"):format(maxY - minY))
See also
getElementBoundingBoxReturns the box surrounding the element's model, relative to its centre.engineGetModelBoundingBoxReturns a model's collision box: the minimum and maximum x, y, z relative to the model centre, and finally the radius of the collision sphere. The data comes from the collision loaded by the game, so it works for cars, peds and objects. Useful for placing things on the ground, measuring size and framing the camera.