class Zones
package fivem.client.core
Zone tracking for the local player: enter, exit and inside callbacks over
the shapes in fivem.shared.colshape.
Zones.add(new Circle(shopPoint, 2.0, 3.0), {
onEnter: _ -> Ui.showHelp("Press ~INPUT_CONTEXT~ to shop"),
onExit: _ -> closeShopPrompt()
});
Every zone is polled from a single shared thread rather than one thread
each, so registering a hundred zones costs one loop, not a hundred. The
poll runs at pollIntervalMs (200 ms by default) and each shape is
rejected by a cheap bounding-sphere test before its real containment test
runs.
Zones live for as long as the resource does. Remove them on stop if the handlers touch anything that needs cleaning up.
Static variables
staticpollIntervalMs:Int = 200
How often the player's position is checked against every zone.
200 ms is imperceptible for walking and cheap enough to ignore. Lower it if players routinely cross zone boundaries at speed — a car at 100 km/h covers 5.5 metres between polls.
Static methods
staticaddBox(center:Vector3, size:Vector3, options:ZoneOptions, heading:Float = 0):Zone
Convenience for an oriented box.
staticaddCircle(center:Vector3, radius:Float, options:ZoneOptions, height:Float = 0):Zone
Convenience for the most common shape: a cylinder around a point.
staticaddSphere(center:Vector3, radius:Float, options:ZoneOptions):Zone
Convenience for a sphere, where height genuinely matters.