Converting vector3 orientation to UI rotation

Since the y axis of a vector3 for orientation and the rotation property of ui components is a bit different, I wanted to know if there is a way to convert one to the other, because simply copying the value doesnt seem to give the proper orientation.

3 Likes

y axis isn’t used for rotation, and uis have only x and y axis.

1 Like

Am not sure if I understand you right but here is what worked for me

local function vecAngleToGuiAngle(vecAngle)
	return -(vecAngle+180)
end

game:GetService("RunService").RenderStepped:Connect(function(dt)
	workspace.Part.CFrame *= CFrame.Angles(0, dt*10, 0)
	local y = workspace.Part.Orientation.Y
	script.Parent.Rotation = vecAngleToGuiAngle(y)
end)

https://gyazo.com/f7db485e0cf294e6ed4f6af7386bc429

2 Likes

This looks interesting, I will try it.

2 Likes

Wow that worked, thank you very much :pray:

2 Likes