DrawCube
The DrawCube function draws the outline of a cube in 3D space. This function is useful for visualizing cubic areas or regions in the game world.
Parameters
x(number): The x-coordinate of the cube's origin.y(number): The y-coordinate of the cube's origin.z(number): The z-coordinate of the cube's origin.length(number): The length of the cube.width(number): The width of the cube.height(number): The height of the cube.r(number): The red color component (0.0 to 1.0).g(number): The green color component (0.0 to 1.0).b(number): The blue color component (0.0 to 1.0).a(number): The alpha (transparency) value (0.0 to 1.0).thickness(number): The thickness of the cube's edges.facing_target(string, optional): The unit the cube should face.
Example Usage in Lua
Here is an example of how to use the DrawCube function in Lua:
local api = ...
-- Function to draw a blue cube with specified dimensions and color at the given coordinates
function DrawBlueCube(x, y, z, length, width, height)
local r = 0.0
local g = 0.0
local b = 1.0
local a = 1.0
local thickness = 2.0
api.DrawCube(x, y, z, length, width, height, r, g, b, a, thickness)
print("Drew a blue cube at (" .. x .. ", " .. y .. ", " .. z .. ") with dimensions " .. length .. "x" .. width .. "x" .. height)
end
-- Example usage: Draw a blue cube at coordinates (10, 20, 30) with dimensions 5x5x5
DrawBlueCube(10, 20, 30, 5, 5, 5)