Types/BoundingBox: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(added description of coordinates)
m ("full" example using left_top and right_bottom)
Line 7: Line 7:


The first position is assumed to be leftTop, the second position is assumed to be rightBottom. A third member may be added, a [[Types/float]] that represents the orientation, however it does not seem to be used.
The first position is assumed to be leftTop, the second position is assumed to be rightBottom. A third member may be added, a [[Types/float]] that represents the orientation, however it does not seem to be used.
The less commonly seen, but expanded form:
    {
        left_top = {-0.4, -0.4},
        right_bottom = {0.4, 0.4}
    }

Revision as of 17:42, 9 June 2022

BoundingBox is set of two Types/Position. BoundingBoxes are typically centered around the position of an entity.

In Factorio, the coordinate system is in a "programming" orientation, left-to-right, top-to-bottom. The upper-left point is the least dimension in x and y, and lower-right is the greatest.

It is specified like this:

   {{-0.4, -0.4}, {0.4, 0.4}}

The first position is assumed to be leftTop, the second position is assumed to be rightBottom. A third member may be added, a Types/float that represents the orientation, however it does not seem to be used.

The less commonly seen, but expanded form:

   {
       left_top = {-0.4, -0.4},
       right_bottom = {0.4, 0.4}
   }