2

# How would I make an ImageLabel rotate with the direction of the camera?

I'm working on a mini-map, but I'm having problems with making the arrow in the center rotate to match the camera's rotation.

( Like in any RPG mini-map. The arrow points towards the direction you're facing.)

I've tried using lookVector and :toEulerAnglesXYZ(), but neither seem to work correctly.

The two codes I've tried are;

local x,y = workspace.CurrentCamera.CoordinateFrame:toEulerAnglesXYZ();
script.Parent.Frame.Dot.Arrow.Rotation = math.deg(x);

and

script.Parent.Frame.Dot.Arrow.Rotation = math.deg(workspace.CurrentCamera.CoordinateFrame.lookVector.X);


3
9 years ago

Relevant wiki article.

What you are looking for in the three shown in the above article is Heading, which, when looking from the top down as in a minimap, shows which direction on ROBLOX's xz plane the camera is facing.

local pip = script.Parent.Frame.Dot.Arrow

local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = Workspace.CurrentCamera.CoordinateFrame:components()