-
Notifications
You must be signed in to change notification settings - Fork 193
BoxZone
Michael Afrin edited this page Aug 23, 2020
·
4 revisions
An BoxZone is created by invoking the BoxZone:Create()
method, and passing in a center, length, width and a table of options:
local boxZone = BoxZone:Create(vector3(0.0, 0.0, 0.0), 3.0, 5.0, {
name="box_zone",
offset={0.0, 0.0, 0.0},
scale={1.0, 1.0, 1.0},
debugPoly=false,
})
Note: BoxZones don't use the grid optimization, since all BoxZones are simple bounding boxes. Because of this, use the debugPoly
option to enable debug drawing, instead of debugGrid
. Any option that can be passed into regular PolyZones can be passed into BoxZones, though any grid related options are ignored. There are a few additional options for BoxZones, seen in the table below.
Property | Type | Default | Required | Description |
---|---|---|---|---|
heading | Integer | 0 | false | The heading (rotation) of the BoxZone, in degrees. If set to 0, the zone acts as an axis-aligned bounding box, and is more performant as a result. |
offset | Table | {0.0, 0.0, 0.0} | false | A table of numbers to offset the entity zone by an absolute amount. This table can either contain 6 numbers, with the layout being {forward, back, left, right, up, down}, or 3 numbers if you want symmetrical offsets, with the layout being {forward/back, left/right, up/down} |
scale | Table | {1.0, 1.0, 1.0} | false | Same as the offset option, but scales the entity zone, instead of offsetting it |
Notes:
- A BoxZone is scaled before it is offset. Therefore a direction's length is calculated as
directionLength * directionScale + directionOffset
. - Setting length, width, and center real time should be avoided if you can. These require a recalculation of the points of the zone, which is expensive.