Angle from 0 to 180 starting from down to up

Hi guys, i wanted to ask how i make like, angle from 0 to 180 starting from down to up.
like, here’s a example starting from 0 to 90.

image

I want to do like that, using some math script.
Because, i tried to use like a divided “/” math but doesn’t work.

So, how to do like that?

1 Like

With a part of with a ui/surfacegui?

No, just part like, X Axis -90 gets converted to 0 using some math, then rotating it up with X will increase it, instead of decreasing to 0.

You can define a function that does this with simple math:

local function angleFromBottom(xAngle)
    return CFrame.Angles(
        math.rad(90 - xAngle),
        0,
        0
    )
end

And usage:

-- sets the orientation as 37 degrees from the bottom
part.CFrame = angleFromBottom(37) + part.Position

I hope that’s right…

I mean, that i actually want to get value X Axis, starting from 0(90) to 180(-90), like X Axis 90 angle gets converted to 0, and then rotating it up, it will increases instead of decreasing until 0 to -90, i want to get a value X Axis from it using some math, not changing CFrame/Position/Orientation.

Nevermind, i figured it out by myself.
I had to do on this way, to get X Axis from 0(-90) to 180(90).

And i confess, it works but gets some a bit of memory usage client, because it uses Repeat Until.

Script

local xresult = 0 
local xpart = Instance.new("Part") 
xpart.CFrame = xpart.CFrame * CFrame.Angles(math.rad(-90),0,0) 
repeat 
local done = false 
if xpart.Orientation.X == game.Workspace.Part.Orientation.X then 
done = true 
else 
xpart.CFrame = xpart.CFrame * CFrame.Angles(math.rad(1),0,0) 
xresult=xresult+1 
end 
until done == true
xpart:Destroy()
print(xresult)

Output

Basically, it creates a part temporary set to -90 X Axis Angle, and uses Repeat Until for XResult variable and CFrame Angle X, it will degree +1 Axis Angle from temporary part and increasing the XResult variable until the part temporary is same Orientation X from the specified part.

But the problem is that there is a chance of that causing a script timeout with it.