The title is all you need to know.
How can i make a bar that fills up a bar when you look Up then the bar fills down when you look down
Well you can check the Angle that the Camera is in on the X axis, and in order to have the Rotation be formatted to XYZ, you can use :ToOrientation()
to do that
local x,y,z = Camera.CFrame.Rotation:ToOrientation()
The Function will return the Rotations in Radians, so you need to use math.deg()
to convert them to degrees.
You can then check the Angle the Camera is going in (which will likely be 80° both Positive and Negative) and divide the number by 80, which should give you a number between 0 and 1, from there you can apply the size of the Frame.
Are you sure that you need all that?
I think CFrame.LookVector.Y
is enough information to do this.
Yeah you could, but the Only Issue with that is that the Camera doesnt make a full 90 degree angle (or isnt 1), and only goes up to about 80 degrees, which wouldn’t completely fill up the bar, which is what I was trying to do.
Depending on the Size of the bar, you can see that it doesnt reach to full.
Edit: Dividing by .98 seems to have it work.