How could I achieve this camera trick with UI?

Here are some examples:
https://gyazo.com/3dec40adf79ce2b2d20c8009c9355402
https://gyazo.com/b10bb9474e6c8d590817a64eb14ea5f6
To be honest, I am not that experienced with camera manipulation, any help will be appreciated.

Thank you for reading and possibly helping :slight_smile:

I think you need to get the mouse X and Y and make the camera move

I’ve done this before. It’s really simple once you find a method that works for you, what I did was something among the lines of…

local camera = workspace.CurrentCamera
local viewport = camera.ViewportSize --//Current screen size of player
local mouse = game.Players.LocalPlayer:GetMouse()

local MAX_X_ROTATION = 45
local MAX_Y_ROTATION = 45

game["Run Service"].RenderStepped:Connect(function()
local X_scale = mouse.X / viewport.X
local Y_scale = mouse.Y / viewport.Y

camera.CFrame = CFrame.Angles(math.rad(MAX_Y_ROTATION*Y_scale), math.rad(MAX_X_ROTATION*X_scale), 0)
end)

I probably left some stuff out, and obviously when I set the camera’s CFrame I don’t take into account any position it should be at, but that’s pretty easy to add in. Something similar to this system is what I would use. You might also need to swap MAX_Y_ROTATION for MAX_X_ROTATION, not exactly sure how this’ll look.

2 Likes