Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to change camera in different places?

Asked by 8 years ago

So I have a 2D camera setup for my platformer, when I teleport to another place, I want that camera to be in its normal state, but if i teleport to another level, the camera needs to go back to 2D mode

01--This is a normal script named TwoD
02cam = workspace.CurrentCamera
03 
04lockCamera = true
05    distance = 30
06    height = 5
07 
08function GetMass(object)
09    local mass = 0
10    if pcall(function() return object:GetMass() end) then
11        mass = object:GetMass()
12    end
13    for _,child in pairs(object:GetChildren()) do
14        mass = mass + GetMass(child)
15    end
View all 52 lines...
01-- This is a LocalScript (child of TwoD above)
02lockCamera = true
03    distance = 30
04    height = 5
05 
06local torso = script.Parent.Torso
07local center = Instance.new("Part")
08center.Name = script.Parent.Name .. " Center"
09center.Transparency = 1
10center.CanCollide = false
11center.Size = Vector3.new(1,1,1)
12center.Position = torso.Position
13center.CFrame = CFrame.new(Vector3.new(0,0,0),Vector3.new(0,0,-1))
14center.Parent = game.Workspace
15local bp = Instance.new("BodyPosition")
View all 32 lines...

Answer this question