- What do you want to achieve? Keep it simple and clear!
I’m trying to make an arrow cursor point in the direction the camera is moving, similar to this: https://gyazo.com/34e5bc057680f1ff9d06c1b13d51f8ac
- What is the issue? Include screenshots / videos if possible!
The arrow points off to the corner and barely budges when I move the camera.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried a variety of trigonometry functions, none of them seem to work.
My current script:
local plr = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local lastlookvector = cam.CFrame.LookVector
local UIS = game:GetService('UserInputService')
UIS.InputChanged:Connect(function(input)
if input.UserInputType==Enum.UserInputType.MouseMovement then
local movementX = input.Delta.X
local movementY = input.Delta.Y
local offsetpoint1 = (cam.ViewportSize.X/2+movementX)
local offsetpoint2 = (cam.ViewportSize.Y/2+movementY)
local angle = math.atan2(offsetpoint2,offsetpoint1)
local convertedangle = ((angle/math.pi)*180)
print(math.deg(angle))
script.Parent.Rotation=convertedangle
end
end)