Skip to content

DrawCone

The DrawCone function draws an outline of a cone in 3D space. This function is useful for visualizing conical areas or regions in the game world.

Parameters

  • bossX (number): The x-coordinate of the cone's base center.
  • bossY (number): The y-coordinate of the cone's base center.
  • bossZ (number): The z-coordinate of the cone's base center.
  • bossFacing (number): The facing direction of the cone's base center.
  • coneLength (number): The length of the cone.
  • coneAngle (number): The angle of the cone.
  • 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 cone's outline.

Example Usage in Lua

Here is an example of how to use the DrawCone function in Lua:

local api = ...

-- Function to draw a green cone with a length of 10, angle of 45 degrees, and thickness of 2 at the specified coordinates
function DrawGreenCone(bossX, bossY, bossZ, bossFacing)
    local coneLength = 10.0
    local coneAngle = 45.0
    local r = 0.0
    local g = 1.0
    local b = 0.0
    local a = 1.0
    local thickness = 2.0
    api.DrawCone(bossX, bossY, bossZ, bossFacing, coneLength, coneAngle, r, g, b, a, thickness)
    print("Drew a green cone at (" .. bossX .. ", " .. bossY .. ", " .. bossZ .. ") facing " .. bossFacing .. " with length " .. coneLength .. ", angle " .. coneAngle .. ", and thickness " .. thickness)
end

-- Example usage: Draw a green cone at a boss coordinates from his location outwards. 
local x,y,z = api.GetObjectPosition('target')
DrawGreenCone(x,y,z, api.GetObjectFacing('target'))