mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(zones): debugBox draw lines on edges
It's an abomination until Doka works his magic.
This commit is contained in:
@@ -77,6 +77,38 @@ CreateThread(function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local DrawLine = DrawLine
|
||||||
|
|
||||||
|
local function debugBox(self)
|
||||||
|
if not self.debugCoords then
|
||||||
|
self.debugCoords = {
|
||||||
|
self.centroid + vec3(self.size.x, self.size.y, self.thickness) * self.rotation,
|
||||||
|
self.centroid + vec3(-self.size.x, self.size.y, self.thickness) * self.rotation,
|
||||||
|
self.centroid + vec3(-self.size.x, -self.size.y, self.thickness) * self.rotation,
|
||||||
|
self.centroid + vec3(self.size.x, -self.size.y, self.thickness) * self.rotation,
|
||||||
|
self.centroid - vec3(self.size.x, self.size.y, self.thickness) * self.rotation,
|
||||||
|
self.centroid - vec3(-self.size.x, self.size.y, self.thickness) * self.rotation,
|
||||||
|
self.centroid - vec3(-self.size.x, -self.size.y, self.thickness) * self.rotation,
|
||||||
|
self.centroid - vec3(self.size.x, -self.size.y, self.thickness) * self.rotation,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
DrawLine(self.debugCoords[1], self.debugCoords[2], 255, 0, 0, 150)
|
||||||
|
DrawLine(self.debugCoords[2], self.debugCoords[3], 255, 0, 0, 150)
|
||||||
|
DrawLine(self.debugCoords[3], self.debugCoords[4], 255, 0, 0, 150)
|
||||||
|
DrawLine(self.debugCoords[4], self.debugCoords[1], 255, 0, 0, 150)
|
||||||
|
|
||||||
|
DrawLine(self.debugCoords[5], self.debugCoords[6], 255, 0, 0, 150)
|
||||||
|
DrawLine(self.debugCoords[6], self.debugCoords[7], 255, 0, 0, 150)
|
||||||
|
DrawLine(self.debugCoords[7], self.debugCoords[8], 255, 0, 0, 150)
|
||||||
|
DrawLine(self.debugCoords[8], self.debugCoords[5], 255, 0, 0, 150)
|
||||||
|
|
||||||
|
DrawLine(self.debugCoords[1], self.debugCoords[7], 255, 0, 0, 150)
|
||||||
|
DrawLine(self.debugCoords[2], self.debugCoords[8], 255, 0, 0, 150)
|
||||||
|
DrawLine(self.debugCoords[3], self.debugCoords[5], 255, 0, 0, 150)
|
||||||
|
DrawLine(self.debugCoords[4], self.debugCoords[6], 255, 0, 0, 150)
|
||||||
|
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)
|
||||||
@@ -108,7 +140,7 @@ return {
|
|||||||
vec3(data.size.x, -data.size.y, 0),
|
vec3(data.size.x, -data.size.y, 0),
|
||||||
}) + data.centroid)
|
}) + data.centroid)
|
||||||
data.remove = removeZone
|
data.remove = removeZone
|
||||||
data.debug = data.debug and debug
|
data.debug = data.debug and debugBox
|
||||||
data.contains = contains
|
data.contains = contains
|
||||||
|
|
||||||
zones[data.id] = data
|
zones[data.id] = data
|
||||||
|
|||||||
Reference in New Issue
Block a user