You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to close the gaps between the right triangles.
-
What is the issue? Include screenshots / videos if possible!
there are gaps between the right triangles in my radar chart
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried asking for help on HiddenDevs discord server, but couldn’t get any
Would you mind uploading the code instead of a screenshot of it? It’s too tiny to read in my browser and I prefer copying it into an editor for reading and tinkering anyway
function triangles.NewTriangle(a, b, c, parent)
local edges = {
{longest = (c - a), other = (b - a), origin = a},
{longest = (a - b), other = (c - b), origin = b},
{longest = (b - c), other = (a - c), origin = c}
};
local edge = edges[1];
for i = 2, #edges do
if (edges[i].longest.magnitude > edge.longest.magnitude) then
edge = edges[i];
end
end
local theta = math.acos(edge.longest.unit:Dot(edge.other.unit));
local w1 = math.cos(theta) * edge.other.magnitude * edge.longest.unit;
local w2 = edge.longest - w1;
local h = math.sin(theta) * edge.other.magnitude;
local r = w1 - edge.other;
local rotation = math.atan2(r.y, r.x) - math.pi/2;
local nz = -edge.other:Cross(r);
local tlc1 = edge.origin + edge.other;
local tlc2 = nz < 0 and tlc1 - w1 or tlc1 + w2;
local width2 = tlc1 - tlc2
local width1 = width2.unit * (edge.longest.magnitude - width2.magnitude);
local center1 = tlc1 + (width1 + r) * 0.5;
local center2 = tlc2 + (width2 + r) * 0.5;
local max = 120
local w1m, w2m = math.floor((width1.Magnitude/max) * 120), math.floor((width2.Magnitude/max) * 120)
local rightward = IMG:Clone();
rightward.Image = "rbxassetid://319692171";
rightward.Position = UDim2.new(0, center1.x, 0, center1.y);
rightward.Size = UDim2.new(0, w1m, 0, h);
rightward.Rotation = math.deg(rotation);
rightward.Parent = parent;
local leftward = IMG:Clone();
leftward.Image = "rbxassetid://319692151";
leftward.Position = UDim2.new(0, center2.x, 0, center2.y);
leftward.Size = UDim2.new(0, w2m, 0, h);
leftward.Rotation = math.deg(rotation);
leftward.Parent = parent;
return rightward, leftward
end