DrawFilledRectangle
The DrawFilledRectangle function draws a filled rectangle in 3D space. This function is useful for visualizing solid rectangular areas or regions in the game world.
Parameters
x(number): The x-coordinate of the rectangle's origin.y(number): The y-coordinate of the rectangle's origin.z(number): The z-coordinate of the rectangle's origin.width(number): The width of the rectangle.height(number): The height of the rectangle.facing(number): The facing direction of the rectangle.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 rectangle's edges.segments(number): The number of segments used to draw the rectangle.
Example Usage in Lua
Here is an example of how to use the DrawFilledRectangle function in Lua:
local api = ...
-- Function to draw a filled blue rectangle with specified dimensions and color at the given coordinates
function DrawFilledBlueRectangle(x, y, z, width, height, facing)
local r = 0.0
local g = 0.0
local b = 1.0
local a = 1.0
local thickness = 2.0
local segments = 4
api.DrawFilledRectangle(x, y, z, width, height, facing, r, g, b, a, thickness, segments)
print("Drew a filled blue rectangle at (" .. x .. ", " .. y .. ", " .. z .. ") with dimensions " .. width .. "x" .. height)
end
-- Example usage: Draw a filled blue rectangle at coordinates (10, 20, 30) with dimensions 5x10 facing 90 degrees
DrawFilledBlueRectangle(10, 20, 30, 5, 10, 90)