Trying To Recreate Camera Pan From Zelda

So I’m currently contemplating how I should go about coding a camera much like the Legend of Zelda. Anyone who’s played the top/down games, knows that when entering an area, the camera pans in that direction. My question for you is, can someone point me in the right direction on how to achieve this goal? I’ve been dabbling in camera manipulation lately but I’m still quite new to it, any advice is appreciated.

https://education.roblox.com/en-us/resources/arcade-game-top-down-camera

image

“more of the game game” THIS MADE ME LAUGH WAY TOO MUCH LOL

This is a huge help, this much I do know. I actually have this part functioning as we speak.

Have you tested it out yet? I believe it should just work fine by using RunService’s RenderStepped Event

Yep it works like a charm. I still have yet to figure out how I should go about panning the camera when entering a new space.

Try messing around with the CAMERA_OFFSET variables, I believe you could disconnect the function that changes the Camera position every time and make it pan somewhere else if you want it to activate something else

1 Like

Thank you for the assistance, i’ll try this asap.

1 Like

I’m not certain if this would work but you could try this script once a part gets touched by using a Touched event

--Creates a top-down camera for each player. Should be used as a     LocalScript
 
--Get service needed for events used in this script
local RunService = game:GetService("RunService")	

-- Variables for the camera and player
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local Part = workspace.Part
local Touched = false

Part.Touched:Connect(function()
    Touched = true
end)
 
-- Constant variable used to set the camera’s offset from the player
local CAMERA_OFFSET = Vector3.new(-1,90,0)
 
-- Enables the camera to do what this script says
camera.CameraType = Enum.CameraType.Scriptable
 
local Connection
-- Called every time the screen refreshes
local function onRenderStep()
    if Touched == true then
        Connection:Disconnect()
    end
	-- Check the player's character has spawned
	if player.Character then
		local playerPosition = player.Character.HumanoidRootPart.Position
		local cameraPosition = playerPosition + CAMERA_OFFSET
		
		-- make the camera follow the player
		camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
	end
end
 
Connection = RunService.RenderStepped:Connect(onRenderStep)
2 Likes

This is very useful, thank you.