getElementBoundingBox | Multi Theft Auto: Wiki Skip to content

getElementBoundingBox

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 returns the minimum and maximum coordinates of an element's bounding box.

Note

The element must be streamed in for this function to work.

OOP Syntax Help! I don't understand this!

  • Method:element:getBoundingBox(...)

Syntax

float,​ float,​ float,​ float,​ float,​ float getElementBoundingBox ( element theElement )
Required Arguments
  • theElement: the element whose bounding box we want to get.

Returns

  • float: value1
  • float: value2
  • float: value3
  • float: value4
  • float: value5
  • float: value6

This example outputs to chatbox the minimum and the maximum coordinates of an element.

Code Examples

shared

This example outputs to chatbox the minimum and the maximum coordinates of an element.

function minMaxOutput( theElement )
local x0, y0, z0, x1, y1, z1 = getElementBoundingBox( theElement )
if ( x0 ) then
outputChatBox( "The coords are: " .. x0 .. ", " .. y0 .. ", " .. z0 .. ", " .. x1 .. ", " .. y1 .. ", " .. z1 )
else
outputChatBox( "Failed to retrieve bounding box" )
end
end

See Also

Element Functions