Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
DebugText
FunctionscreateWithNode
DescriptionDefinitioncreateWithNode()Code
54 | function DebugText:createWithNode(node, text, size) |
55 | local x, y, z = getWorldTranslation(node) |
56 | local rotX, rotY, rotZ = getWorldRotation(node) |
57 | |
58 | self:createWithWorldPosAndRot(x, y, z, rotX, rotY, rotZ, text, size) |
59 | end |
createWithNodeToCamera
DescriptionDefinitioncreateWithNodeToCamera()Code
63 | function DebugText:createWithNodeToCamera(node, yOffset, text, size) |
64 | local x, y, z = localToWorld(node, 0, yOffset, 0) |
65 | local cx, cy, cz = getWorldTranslation(getCamera()) |
66 | local dirX, _, dirZ = MathUtil.vector3Normalize(cx-x, cy-y, cz-z) |
67 | local rotY = MathUtil.getYRotationFromDirection(dirX, dirZ) |
68 | |
69 | self:createWithWorldPosAndRot(x, y, z, 0, rotY, 0, text, size) |
70 | end |
createWithWorldPosAndRot
DescriptionDefinitioncreateWithWorldPosAndRot()Code
74 | function DebugText:createWithWorldPosAndRot(x, y, z, rotX, rotY, rotZ, text, size) |
75 | self.x, self.y, self.z = x, y, z |
76 | self.rotX, self.rotY, self.rotZ = rotX, rotY, rotZ |
77 | self.text = text |
78 | self.size = size |
79 | end |
draw
DescriptionDefinitiondraw()Code
39 | function DebugText:draw() |
40 | setTextDepthTestEnabled(false) |
41 | setTextAlignment(self.alignment) |
42 | setTextVerticalAlignment(self.verticalAlignment) |
43 | setTextColor(self.r, self.g, self.b, self.a) |
44 | |
45 | renderText3D(self.x, self.y, self.z, self.rotX, self.rotY, self.rotZ, self.size, self.text) |
46 | |
47 | setTextAlignment(RenderText.ALIGN_LEFT) |
48 | setTextVerticalAlignment(RenderText.VERTICAL_ALIGN_BASELINE) |
49 | setTextDepthTestEnabled(true) |
50 | end |
new
DescriptionDefinitionnew()Code
15 | function DebugText:new(customMt) |
16 | local self = setmetatable({}, customMt or DebugText_mt) |
17 | |
18 | self.x, self.y, self.z = 0, 0, 0 |
19 | self.rotX, self.rotY, self.rotZ = 0, 0, 0 |
20 | self.alignment = RenderText.ALIGN_LEFT; |
21 | self.verticalAlignment = RenderText.VERTICAL_ALIGN_MIDDLE; |
22 | self.r, self.g, self.b, self.a = 1, 1, 1, 1 |
23 | self.size = 0.1 |
24 | |
25 | self.text = nil |
26 | self.alignToGround = false |
27 | |
28 | return self |
29 | end |