mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
tweak(zones): store distance to zone center
Should make sphere "zones" nearly 1:1 with the points api. Distance added for polygons too for consistency and some use-cases, but generally only worthwhile for smaller zones.
This commit is contained in:
@@ -302,11 +302,13 @@ end
|
|||||||
local glm_polygon_contains = glm.polygon.contains
|
local glm_polygon_contains = glm.polygon.contains
|
||||||
|
|
||||||
local function contains(self, coords)
|
local function contains(self, coords)
|
||||||
|
self.distance = #(self.coords - coords)
|
||||||
return glm_polygon_contains(self.polygon, coords, self.thickness / 4)
|
return glm_polygon_contains(self.polygon, coords, self.thickness / 4)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function insideSphere(self, coords)
|
local function insideSphere(self, coords)
|
||||||
return #(self.coords - coords) < self.radius
|
self.distance = #(self.coords - coords)
|
||||||
|
return self.distance < self.radius
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user