Converting the dot product into degrees

I have the dot product between the players lookvetor and a dummys position and I want to convert it into a 360 degrees to I can rotate a part to look at the dummy how can I do this I have tried 369 - Angle * 360 but that failed any other ways?

wait(2.5)

local CurrentCamera = workspace.CurrentCamera
local Dummy = workspace.Dummy

while wait() do
	local Angle = CurrentCamera.CFrame.LookVector.Unit:Dot(Dummy.PrimaryPart.Position.Unit)
	print(360 - Angle * 360)
end
1 Like

if you want it the part to look at the player you can just do this

game.Workspace.Part.CFrame = CFrame.lookAt(game.Workspace.Part.Position, game.Workspace.Dummy.HumanoidRootPart.Position)

I am using frames so I need it to be a rotation.

oh welp, Iā€™m bad at math so gl.

The dot product will get you the cosine of the angle.

So you can use math.acos to get the angle and then math.deg, if you want it to be in degrees.

8 Likes