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

Rotating camera after disabling the camera?

Asked by
Xonois -3
5 years ago

So I've disabled camera usage in my game, but I still want them to be able to zoom in and out and rotate their camera, I don't know if this is possible and I couldn't find any tutorials. Can anyone help?

This is my script:

local offset = Vector3.new(-5,50,0)
local fieldOfView = 50
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)

1 answer

Log in to vote
0
Answered by
tantec 305 Moderation Voter
5 years ago

You put yourself to a lot of trouble, you should've just changed the CameraSubject

camera.CameraSubject = "what you want the subject to be e.g. game.Workspace.Part"
0
Oops, I didn't seem to specify enough, I mean I want them to be able to only move their camera on the X axis and not the Y axis and also be able to zoom in and out. Xonois -3 — 5y
Ad

Answer this question