Point b = This Red Thingy
Point C = This Orange Thingy
That will result in this being created
It must always be in that format though : being two wedges placed side by side.
So all I need to know is how I would kind of connect the points of a wedge to positions.
local function Part()
local p = Instance.new("WedgePart")
p.Anchored = true
return p
end
--Make triangle from three vertices
local function FindBase(v1, v2, v3)
--local p1 = Part()
--local p2 = Part()
--Project one point onto the other two to form base
--local p = line.origin - line.origin:Dot(line.dir.Unit)*line.dir.Unit
local function TryThing(start, finish, top)
local d12 = finish - start
local n = (top - start)*d12
local u = (n.X + n.Y + n.Z) / (math.pow(d12.X, 2.0) + math.pow(d12.Y, 2.0) + math.pow(d12.Z, 2.0))
return u, start + u * d12
end
--Try each of three layouts, one must work
local u, p = TryThing(v1, v2, v3)
if 0.0 < u and u < 1.0 then
return p, v1, v2, v3
end
local u, p = TryThing(v2, v3, v1)
if 0.0 < u and u < 1.0 then
return p, v2, v3, v1
end
local u, p = TryThing(v3, v1, v2)
if 0.0 < u and u < 1.0 then
return p, v3, v1, v2
end
end
local pb = workspace.P1:Clone()
pb.Name = "P4"
pb.Parent = workspace
pb.BrickColor = BrickColor.Red()
local tri1
local tri2
local function RemakeTris()
wait(1)
if tri1 ~= nil then
tri1:Remove()
end
if tri2 ~= nil then
tri2:Remove()
end
local p, v1, v2, v3 = FindBase(workspace.P1.Position, workspace.P2.Position, workspace.P3.Position)
pb.Position = p
tri1 = Part()
tri1.Parent = workspace
local up = (v3 - p).Unit
local cf = CFrame.lookAt(p, v1, up)
local length = (v1-p).Magnitude
local height = (v3-p).Magnitude
tri1.CFrame = cf + cf:VectorToWorldSpace(Vector3.new(0, height / 2.0, -length / 2.0))
tri1.Size = Vector3.new(1.0, height, length)
tri2 = Part()
tri2.Parent = workspace
local up = (v3 - p).Unit
local cf = CFrame.lookAt(p, v2, up)
local length = (v2-p).Magnitude
local height = (v3-p).Magnitude
tri2.CFrame = cf + cf:VectorToWorldSpace(Vector3.new(0, height / 2.0, -length / 2.0))
tri2.Size = Vector3.new(1.0, height, length)
end
RemakeTris()
workspace.P1:GetPropertyChangedSignal("Position"):Connect(RemakeTris)
workspace.P2:GetPropertyChangedSignal("Position"):Connect(RemakeTris)
workspace.P3:GetPropertyChangedSignal("Position"):Connect(RemakeTris)
Look at the last image, it has 2 wedges of the same size, but using the code that you sent makes it so it sometimes changes format, such as there being a really big wedge and a tiny wedge.
If that is the case, it might not be wise to use three points to define the triangle, as there are many possibilities with this setup that lead to unsymmetrical triangles.
Yeah as @goldenguy9 said your image shows an isosceles triangle two of the sides have the same length, only in that case can you divide the triangle into two equal right triangles.
The general case is for a scalene triangle is EgoMooses, it is not possible to divide it in two of the same size right triangle pieces in that case.
You need three points to define a triangle no matter what kind of triangle it is. You could define a class of isoceles triangles with just a base and a height, but that would not specify where the triangle is in space or which way its facing; there would be infinite triangles which would fit that class, just all with the same area.
You are correct. I was assuming that in OP’s face the triangle would always be “facing” the same direction. In which case, the circled point could be inferred without actually being defined.
And then you could use this to find the point symmetrical to the point on the bottom left
Ok. I have used @BilonGamer’s method of using that documentation, but now I am just struggling on trying to make it look not funny because of the transparent parts.
METHOD 1: Set the wedges transparency to 0.75 (what I want it to be at.)
Result:
That is not really a bug at all, it’s just because of the way transparent parts are displayed. When a part is transparent, you can see through it. If you can see through it, it can overlap with other transparent parts resulting in these darker regions.
As to how to actually achieve this effect, I’m not really sure right now. Maybe you could use an Outline object, but I haven’t tested that.