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

Help with camera manipulation?

Asked by 5 years ago

I currently have this script that locks a top-down view, but I want the camera to keep the player centred on the X axis, not the Z axis. How do I make that happen?

Current top-down script:

local offset = Vector3.new(-5,50,0)
local fieldOfView = 30
local player = script.Parent.Parent
local camera = game.Workspace.CurrentCamera
local runService = game:GetService("RunService")

camera.FieldOfView = fieldOfView
local function onRenderStep()

local playerPosition = player.Character.HumanoidRootPart.Position
local cameraPosition = playerPosition + offset
camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
end

runService:BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, onRenderStep)
0
Double check the roblox studio cookbook, NOT FOR COOKING. Go to this link: https://developer.roblox.com/en-us/quick-start and search top-down camera and it should come up diorlandripp 4 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
camera.CoordinateFrame = CFrame.new(vector3.new(0, cameraPosition.Y ,cameraPosition.Z), playerPosition)
Ad

Answer this question