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

how do i have the camera always point straight down?

Asked by
theCJarmy7 1293 Moderation Voter
8 years ago
while wait() do
    player = game.Players.LocalPlayer
char = player.Character
cam = game.Workspace.CurrentCamera
cam.Focus=CFrame.new(char.Head.Position)
end

How do i make the camera point at the players head? the camera is in a part, directly above the players head, so if it would point straight down, it would work. I don't see why this focus isn't working, it should be focusing on the players head, but it's not, and i don't see why.

0
If the CameraType is set to Scriptable, then both Focus and CameraSubject will not work. You will have to set the Camera's CoordinateFrame yourself manually. XAXA 1569 — 8y
0
the type is custom, and camera subject works theCJarmy7 1293 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

The issue is that if the camera is perfectly vertical, the program controlling character motion can't figure out what direction to align character movement to, since there's no useful lookvector for the camera. To avoid that, ROBLOX prevented the camera from going above/below a certain angle.

To get around it, you could always use the Scriptable CameraType, and re-implement character motion and camera follow yourself.

edit: example follows

This script is intended to be placed in StarterPlayerScripts and named CameraScript. It doesn't solve the issue of character control.

-- vertical camera script
local HEIGHT = 30
local ANGLE = -90 -- if you make this 90/-90 you won't be able to properly control your character
local ROTATION = 0 -- for side-to-side adjustment

local player = game.Players.LocalPlayer;
local runservice = game:GetService("RunService");

local function CameraUpdate()
    local character = player.Character;
    if (not character) then return; end
    local root = character:FindFirstChild("HumanoidRootPart");
    if (not root) then return; end

    local camera = workspace.CurrentCamera;

    camera.CoordinateFrame = CFrame.new(root.Position) * CFrame.Angles(0, math.rad(ROTATION), 0) * CFrame.Angles(math.rad(ANGLE), 0, 0) * CFrame.new(0, 0, HEIGHT);
end

runservice:BindToRenderStep("VertCamera", Enum.RenderPriority.Camera.Value, CameraUpdate);
0
so theres no way to just have the camera point down? theCJarmy7 1293 — 8y
0
Like I said, you can use the Scriptable type and set the CoordinateFrame yourself. I'll edit with an example. nicemike40 486 — 8y
Ad

Answer this question