# AddPolygonsToRoom (Main.sc)

`AddPolygonsToRoom`(polyBuffer)

  Creates `Polygon` objects based on the point lists in polyBuffer and adds them to the room’s obstacles.

  Parameters: | polyBuffer (heapPtr) – An array with polygon points.

  Example usage:

      (AddPolygonsToRoom @P_ThePolygons)

  The array begins with a number indicating how many polygons there are. This is followed by the following information for each polygon:

  > - A number expressing the type of the polygon (e.g. PBarredAccess).
  > - A number indicating how many points are in the polygon.
  > - (x y) pairs of numbers for each point.

  Example:

      [P_ThePolygons 19] = [2 PContainedAccess 4 319 189 319 50 0 50 0 189 PBarredAccess 3 319 189 319 50 0 50]

  See also: Polygons.