LUADOC - Farming Simulator 22

DebugPoint

Functions

createWithNode

Description
Definition
createWithNode()
Code
49function DebugPoint:createWithNode(node, alignToGround, solid, hideWhenGUIOpen, clipDistance)
50 local x, y, z = getWorldTranslation(node)
51
52 return self:createWithWorldPosAndDir(x, y, z, alignToGround, solid, hideWhenGUIOpen, clipDistance)
53end

createWithWorldPos

Description
Definition
createWithWorldPos()
Code
57function DebugPoint:createWithWorldPos(x, y, z, alignToGround, solid, hideWhenGUIOpen, clipDistance)
58
59 if alignToGround and g_currentMission.terrainRootNode ~= nil then
60 y = getTerrainHeightAtWorldPos(g_currentMission.terrainRootNode, x, 0, z) + 0.1
61 end
62
63 self.x, self.y, self.z = x, y, z
64 self.solid = Utils.getNoNil(solid, self.solid)
65
66 self.hideWhenGuiIsOpen = Utils.getNoNil(hideWhenGUIOpen, self.hideWhenGuiIsOpen)
67 self.clipDistance = Utils.getNoNil(clipDistance, self.clipDistance)
68
69 return self
70end

draw

Description
Definition
draw()
Code
37function DebugPoint:draw()
38 if self.hideWhenGuiIsOpen and g_gui:getIsGuiVisible() then
39 return
40 end
41 if not DebugUtil.isPositionInCameraRange(self.x, self.y, self.z, self.clipDistance) then
42 return
43 end
44 drawDebugPoint(self.x, self.y, self.z, self.color.r, self.color.g, self.color.b, self.color.a, self.solid)
45end

new

Description
Definition
new()
Code
15function DebugPoint.new(customMt)
16 local self = setmetatable({}, customMt or DebugPoint_mt)
17
18 self.x, self.y, self.z = 0, 0, 0
19 self.color = {r=1, g=1, b=1, a=1}
20 self.solid = false
21
22 self.alignToGround = false
23 self.hideWhenGuiIsOpen = false
24 self.clipDistance = 2000
25
26 return self
27end

setClipDistance

Description
Definition
setClipDistance()
Code
85function DebugPoint:setClipDistance(clipDistance)
86 self.clipDistance = clipDistance
87
88 return self
89end

setColor

Description
Definition
setColor()
Code
74function DebugPoint:setColor(r, g, b, a)
75 self.color.r = r or self.color.r
76 self.color.g = g or self.color.g
77 self.color.b = b or self.color.b
78 self.color.a = a or self.color.a
79
80 return self
81end