Ok, you know how the team platters widget draws a circle on the ground below a unit? Basically, I need a gadget that can draw circles, squares and triangles and such like the way that team platters works.
I looked at team platters, and I guessing that this code is where the circle is finnaly drawn:
Code: Select all
function widget:DrawWorldPreUnit()
glLineWidth(3.0)
glDepthTest(true)
glPolygonOffset(-50, -2)
local lastColorSet = nil
for _,unitID in ipairs(spGetAllUnits()) do
if (spIsUnitVisible(unitID)) then
local teamID = spGetUnitTeam(unitID)
if (teamID) then
local udid = spGetUnitDefID(unitID)
local radius = GetUnitDefRealRadius(udid)
if (radius) then
local colorSet = GetTeamColorSet(teamID)
if (trackSlope and (not UnitDefs[udid].canFly)) then
local x, y, z = spGetUnitBasePosition(unitID)
local gx, gy, gz = spGetGroundNormal(x, z)
local degrot = math.acos(gy) * 180 / math.pi
glColor(colorSet[1])
glDrawListAtUnit(unitID, circlePolys, false,
radius, 1.0, radius,
degrot, gz, 0, -gx)
glColor(colorSet[2])
glDrawListAtUnit(unitID, circleLines, false,
radius, 1.0, radius,
degrot, gz, 0, -gx)
else
glColor(colorSet[1])
glDrawListAtUnit(unitID, circlePolys, false,
radius, 1.0, radius)
glColor(colorSet[2])
glDrawListAtUnit(unitID, circleLines, false,
radius, 1.0, radius)
end
end
end
end
end
PS. Can you hide the model of of a unit, but maintain its hit box?
PPS. Do you even need to have a model?
PPPS. I need a unit with out a model, just what ever the script draws.