Simple way of getting angle in right-angle triangle?

This is my method

local Triangle = workspace.Triangle
local Length = math.sqrt(Triangle.Size.Y * Triangle.Size.Y + Triangle.Size.Z * Triangle.Size.Z)
local Angle = math.deg(math.acos(Triangle.Size.Z / Length))

I am using a wedge part as my triangle I just want to know if there is a more simple way of doing it and if my way can be used when I rotate the triangle and change its position and orientation

Yes
Use atan2:


local opposite = Triangle.Size.Z
local adjacent = Triangle.Size.X

local angleInRadians = math.atan2(opposite, adjacent)
local angleInDegrees = math.deg(angle)

atan2 can be used for circles and non right angled triangles

This will work, in trigonometry in school, atan2 and atan are just the inverse methods of tan, and tanAngle = opposite / adjacent

So you are good :ok_hand:

Why does it give a full 360 deg circle then?

local RunService = game:GetService("RunService")

local Control = workspace.Control
local Pointer = workspace.Pointer

RunService.Heartbeat:Connect(function()
	local Difference = Pointer.Position - Control.Position
	local Angle = math.deg(math.atan2(Difference.X, Difference.Y)) - 180
	print(math.abs(Angle))
end)

In that case, try using math.atan