Skip to content

CircleZone

Michael Afrin edited this page Aug 22, 2020 · 2 revisions

Creating a CircleZone

An CircleZone is created by invoking the CircleZone:Create() method, and passing in a center, radius, and a table of options:

local CircleZone = CircleZone:Create(vector3(0.0, 0.0, 0.0), 3.0, {
    name="circle_zone",
    debugPoly=false,
})

Note: CircleZones are basically distance checks with PolyZone helpers on top. For all practical purposes, they cost the same performance to use. CircleZones technically are two zones in one: CircleZone and SphereZone. By using the useZ option, seen below, you can set whether or not your CircleZone ignores the Z coordinate.

Options for a CircleZone

Property Type     Default     Required Description
useZ Boolean false false If true, the CircleZone uses the Z coordinate. Otherwise it ignores it. You can think of this like having a Sphere, if true, and Circle, if false.
debugColor Table {0, 255, 0} false Color of the zone

Helpers

getCenter()
setCenter(center) - center must be a vector3 if useZ is true
getRadius()
setRadius(radius) - radius must be a number

Note: Radius and center can be changed in real time with no performance loss