How to make a script orbit a camera around a position inside a Viewport frame

So Im trying to make it so when shiftlock is turned on a camera orbits around position 0,0,0 in a viewport frame.
Im not good with maths so I’ll need some help heh…
This is what i have for now

local UserInputService = game:GetService("UserInputService")

	if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
		script.Parent.CFrame = --Im bad at maths. Oh and script.Parent is the camera

the camera is in the viewport and the script is in the camera

You could do something like this:

local RotatedCFrame = FocusPart.CFrame * CFrame.Angles(AxisIncrementX, AxisIncrementY, AxisIncrementZ)
script.Parent.CFrame = + RotatedCFrame.LookVector * 10).Position, FocusPart.Position)

I’d do something like:

local runService = (game:GetService("RunService"));
local camera = (...); -- // Whatever camera.
local basePart = (...); -- // Whatever part.
local VIEW_BACK_OFFSET = (10);

local ROTATION = (0);
function RenderStep(dt)
	if (ROTATION >= 360) then
	camera.CFrame = * CFrame.Angles(0, math.rad(ROTATION), 0) *, 0, VIEW_BACK_OFFSET).Position, basePart.CFrame.Position))


is that local RotatedCFrame inside the if statement or/and inside the InputChanged function?

InputChanged function the one you cycle for rotating.
EDIT: Make sure to define AxisIncrement variables and FocusPart

ooh. no the idea is when shiftlock is on when i move my mouse to use :GetMouseDelta() to orbit,0,0) and not a certain object

Orbit around what? The player character?

around the position 0,0,0 in a viewport frame. its still about that web browser thing there is no character. ok well there is but u cant move it or anything its just sitting there. im implementing something like webGL in a roblox web browser lol

then you can do something like this:

--This goes outside
local AxisIncrementX, AxisIncrementY, AxisIncrementZ = 0, 0, 0--Change with the axis rotations you want
--This goes inside the InputBegain even
local CameraX, CameraY, CameraZ = script.Parent.CFrame:ToOrientation()
local RotatedCFrame =, 0, 0)) * CFrame.Angles(0,0,0) * CFrame.Angles(AxisIncrementX, AxisIncrementY, AxisIncrementZ)
script.Parent.CFrame = + RotatedCFrame.LookVector * 10).Position, FocusPart.Position)

EDIT: In the local RotatedCFrame line replace only the 0s of the axis you’re using, I mean the CFrame.Angles()

im such a… ok ill get banned if i say this. sorry for the confusion i want to make the camera work like a follow camera you know like when you die in roblox games you follow the players body in 3rd person
using the mouse delta only that i orbit the center of a viewport frame aka 0,0,0

ok i finally know how to properly explain it.
i want to make a camera in a viewport frame act like the normal camera for the player in 3rd person