yeah… the angle of the slope of a wedge (i.e. a triangle) is the inverse tangent of its dimensions, which is apparently not what you are looking for.
i truly have no idea what you are looking for that’s why i’m asking more specifically what you are trying to do
Well, you should be using the properties of SOHCAHTOA, which is how you would get missing angles/sides for right triangles. (Like the wedge here) This is an example of exercising simple trigonometry formulas. For this one, since you want to get the “slope” or the hypotenuse of the wedge, you would use TOA.
local function getAngle(wedge)
local opposite = wedge.Size.Z
local adjacent = wedge.Size.Y
local hAngle = math.atan(opposite / adjacent)
local hInDeg = math.deg(hAngle)
return hInDeg
end
Hope this helps, and good luck on your developing journey!
wait, you made me realize that I just didnt explained really well what I need to achieve.
what you are trying to do here is finding the slope angle depending on the wedge’s size, but I want to find the slope angle depending on world axis. Here’s an example
do u know the thing for G = bar{(A, 1), (B, 1), (C, 1)} thats like the center of the triangle u could make a vecor that goes through that point and some other point, calculate it from the origin position and do stuff with that atan calculations yabadabadu
and what I need is all the calculations (I’m not in high school so I still dont know a lot of all the math stuff), then everything should be done. Also an idea is to use a raycast.Normal
Since you’re comparing the angle to the horizontal plane, you just need to separate V3 into 2 vectors: 1 for horizontal and 1 for vertical, then you can use trig to get the angle of V3 to the horizontal plane.
V3’s angle doesn’t represent the angle that you want in your drawing, it’s actually the 90 degrees complement of it, so just subtract it from 90 degrees.
Let V_horizontal = (X, 0, Z) of V3
Let V_vertical = (0, Y, 0) of V3
local point1 = Vector3.new() -- one of the blue points
local point2 = Vector3.new() -- one of the blue points
local point3 = Vector3.new() -- one of the blue points
local V1 = point2 - point1
local V2 = point3 - point1
local V3 = V1:Cross(V2)
local V_horizontal = Vector3.new(V3.X, 0, V3.Z)
local V_vertical = Vector3.new(0, V3.Y, 0)
local angle = math.pi/2 - math.atan(V_vertical.Magnitude / V_horizontal.Magnitude) -- final angle to be used in radians
local angleDegrees = math.deg(angle) -- convert angle to degrees form
Note: V3 may point in either direction of the green line depending on how you set up your V1 and V2, but it should still give you the right angle in the end.