Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a Zelda-esque camera?

Essentially I want to place the camera at a fixed point over a certain area. Then, when a player reaches a point (like an exit/entrance) the camera will move over to that new location.

Basically like this: https://youtu.be/VS00FyRwR4w?t=17

I know basic camera controls, but I don't know the steps required in order to make the camera a) positioned in that fashion and b) move in that fashion.

1 answer

Something like this would probably work. Experiment and add some invisible walls that once the player hits (onTouch) moves the camera position. Slider.position = Vector3.new(0,5,0)

(make sure this is a local script in starter pack)


--ignore this--
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local Character = Player.Character

local Cam = game.Workspace.CurrentCamera

local RunService = game:GetService('RunService')


function Prep(Char)
	local cPart = Instance.new("Part", Char)
	cPart.Name = ("CamPart")
	cPart.CanCollide = false
	cPart.Transparency = 1
	cPart.Anchored = false
	cPart.Position = Character:WaitForChild("Head").Position
	local bPos = Instance.new("BodyPosition", cPart)
	bPos.Name = ("Slider")
	bPos.maxForce = Vector3.new(math.huge, math.huge, math.huge)
	bPos.D = (2000)
	bPos.P = (10000)
	Cam.CameraType= 'Custom'
	Cam.CameraType= 'Scriptable'
end


Prep(Character)
local CamPart = Character:WaitForChild("CamPart") 
local Slider = CamPart:WaitForChild("Slider") 
local Torso = Character:WaitForChild("Torso") 

--edit this stuff--

RunService.RenderStepped:connect(function()
	Slider.position = Vector3.new(0,5,0) --change this after hitting an invisible wall
	Cam.CoordinateFrame= CFrame.new(Vector3.new(CamPart.Position.X, CamPart.Position.Y+15, CamPart.Position.Z +5),CamPart.Position)
	Torso.CFrame = CFrame.new(Vector3.new(Torso.Position.X , Torso.Position.Y, 1), Vector3.new(Mouse.Hit.X, Torso.Position.Y, Torso.Position.Z))
end)	

This discussion is preserved as it was. New answers, comments, and votes are closed.