Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Rotating Image Label relative to camera, left and right are inverted, how to fix?

Asked by 6 years ago
Edited 6 years ago

Here's a Gyazo showing the issue https://gyazo.com/ecc3454237ddb81ba8f4a818bc4b6bd0

The reason for it is once the rotation of the camera reaches 179.9 it becomes -179.9 until it reaches 0

local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = game.Workspace.CurrentCamera.CoordinateFrame:components()
heading = math.atan2(m02, m22)
local heading = math.deg(heading)
ImageLabel.Rotation = heading

Here's what the ImageLabels rotation is bottom 0 right 90 top 179.999 left -90

Looking to the top and bottom are correct, it's only right and left that are inverted. How would I fix this?

0
what the heck is math.atan2 greatneil80 2647 — 6y
0
@greatneil80 from the wiki "Returns the arc* tangent of y/x (in radians), but uses the signs of both parameters to find the quadrant of the result. It also handles correctly the case of x being zero." http://wiki.roblox.com/index.php?title=Global_namespace/Mathematical_functions#math.atan2 adam1717 5 — 6y
0
Try making the heading Negative to inverse its sign.. LastApollo 76 — 6y
0
Use :inverse() hiimgoodpack 2009 — 6y
0
Yep that worked, thanks. If one of you wish to write it as a answer I'll mark this as solved. adam1717 5 — 6y

Answer this question