Hey all!
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?