Jump to content

map objects coordinates


Recommended Posts

Hi. Its possible to get coordinates all objects of map loaded in Race (for example to table)?

I know this function can get coords from object, but if object is created in lua script, not in map file :/

local x,y,z = getElementPosition(theObject) 

I know it's weird, but you really need it :?

Link to comment
  • Other Languages Moderators
for _, pObjectData in ipairs( getElementsByType 'object', mapmanager:getRunningGamemodeMap() ) do 
    local fX, fY, fZ 
    fX = tonumber( getElementData( pObjectData, 'posX' ) ) 
    fY = tonumber( getElementData( pObjectData, 'posY' ) ) 
    fZ = tonumber( getElementData( pObjectData, 'posZ' ) ) 
    outputChatBox( 'x = ' .. tostring( fX ) .. ', y = ' .. tostring( fY ) .. ', z = ' .. tostring( fZ ) ) 

Your mapmanager resource should running.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...