RPG Camera - Dynamic Angles

Hey all! :wave:
I’m trying to make a top-down RPG-ish game and I’m currently working on the camera,
this is what I’ve done so far:

And here’s the code I’ve used to get this camera to work
(it’s a slightly modified version of the script explained in this video)

local defaultCameraOffset = Vector3.new(0,15,25)
local defaultFOV = 40

local cameraOffset = defaultCameraOffset
local currentFOV = defaultFOV

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera


Camera.CameraType = Enum.CameraType.Custom

local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
	Camera.FieldOfView = currentFOV
	if Character then
		if Character:FindFirstChild("Head") then
			game:GetService("SoundService"):SetListener(Enum.ListenerType.ObjectCFrame, Character.Head)
			Camera.CFrame = CFrame.lookAt(Character.Head.Position + cameraOffset , Character.Head.Position)	
		end
	end
end)

The main “issue” is that I wanted to add a dynamic camera angle system where in certain areas the camera angle would change to different vectors

I thought of using non-collideable parts with a vector3 variable inside of them but then I don’t really know how to implement that properly

is there a better way?

Also, this script has a few quirks I’ve been trying to solve for a while and I have no idea on how to fix them:

  • The camera is full-on locked to the head, I’d like to have something smoother but everything I’ve tried so far resulted in a more broken camera
  • I’d also love to implement some movement smoothing but I have no idea on how to do that, any help on this?
1 Like

I have done something similar to this by using the humanoidrootpart as the anchor because it does not bob. You could add an offset if you want it to be head height.

2 Likes

I don’t really mind the height, thanks!
also sorry to insist but do you happen to know how to move the camera based on an “is colliding part”? I can’t seem to figure out how to do that

(I rarely write posts here on the forum but this was the main question)

The main “issue” is that I wanted to add a dynamic camera angle system where in certain areas the camera angle would change to different vectors
I thought of using non-collideable parts with a vector3 variable inside of them but then I don’t really know how to implement that properly
is there a better way?

Sorry if I wasn’t too clear!