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

Side Scrolling Camera?

How do I Create a camera angle so that it is always to the side of the player?

( Like a 2D side scrolling game) Help appreciated , thanks :)

1 comment

0

DeviousDeviation created a model that automatically makes the camera side-scrolling. I suggest checking it out.

2 answers

✓ Accepted answer

To do this then you can lock the z axis of the camera so that it's always at a certain position, then use Camera Interpolation in a while loop to set the Camera relative to the player.

local cam = workspace.CurrentCamera
local reference = game.Players.LocalPlayer.Character.Torso
local z = CFrame.new(0,0,0) --Lock z to this point

cam.CameraType = 'Scriptable'

while wait() do
	cam:Interpolate(
		CFrame.new(reference.CFrame.p.X,reference.CFrame.p.Y,z),
		reference.CFrame,
		.3
	)
end

To read more about Camera Interpolation, click this.

1 comment

0

When i Insert this into a local script it does not work

You don't have a variable for the camera therefore you'll need to do this!!!This goes before your script three lines apart!!!

Cam = game.workspace.Camera

Hope it works for you!

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