Getting Object from Tiled map

I’m trying to get information from objects in a Tiled map but I can’t find how. TCastleTiledMapData exposes only the tiles data through TCastleTiledapData.TileRenderData () (which isn’t documented, by the way) but the editor renders the objects, so it contains the data and is accessible. But how?

In general, the answer depends on the exact information you need.

function TUnitsOnMap.IsWater(const TilePosition: TVector2Integer): Boolean;
var
  Tileset: TCastleTiledMapData.TTileset;
  Frame: Integer;
  HorizontalFlip, VerticalFlip, DiagonalFlip: Boolean;
begin
  Result := Map.Data.TileRenderData(TilePosition,
    Map.Data.Layers[0],
    Tileset, Frame, HorizontalFlip, VerticalFlip, DiagonalFlip) and
    { Water is on 1, 5, 9 tiles (counting from 0) in data/maps/tileset-terrain.png . }
    ((Frame mod 4) = 1);
end;

Let me know which exactly information you’re looking for, I can help there more:)

I know I can get information from tile layers, but I need information from object layers (points, rectangles, polygons, ellipses, etc.). For example: I’m using points to mark the player and enemy spawn places and polygons to define the paths. But I can’t find how I can retrieve this information. I need to check their name and type (to know what it defines) and retrieve the information (coordinates, vectors…) to use it in the game.