GetElementBoundingBox: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 14: Line 14:


==Example==  
==Example==  
This example outputs to chatbox the minimum and the maximum coords of an element. If the element doesn't exist or doesn't have such coords, it outputs "false".
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function minMaxOutput( element )
blabhalbalhb --abababa
    x0, y0, z0, x1, y1, z1 = getElementBoundingBox ( element )
--This line does this...
    if ( x0 ) then
mooo
        outputChatBox( "The coords are: " .. x0 .. ", " .. y0 .. ", " .. z0 .. ", " .. x1 .. ", " .. y1 .. ", " .. z1 )
    else
        outputChatBox( "false" )
    end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Client element functions}}
{{Client element functions}}
[[Category:Incomplete]]

Revision as of 08:15, 14 June 2007

This function returns the minimum and maximum x,y,z coords of an element's bounding box.

Syntax

float float float float float float getElementBoundingBox ( element theElement )

Required Arguments

  • theElement: the element whose bounding box we want to get.

Returns

  • Returns min x, min y, min z, max x, max y, max z if the passed element is valid, false otherwise.

Example

This example outputs to chatbox the minimum and the maximum coords of an element. If the element doesn't exist or doesn't have such coords, it outputs "false".

function minMaxOutput( element )
    x0, y0, z0, x1, y1, z1 = getElementBoundingBox ( element )
    if ( x0 ) then
        outputChatBox( "The coords are: " .. x0 .. ", " .. y0 .. ", " .. z0 .. ", " .. x1 .. ", " .. y1 .. ", " .. z1 )
    else
        outputChatBox( "false" )
    end
end

See Also