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

How can I change camera subject to a player and keep it facing forward?

Asked by 7 years ago

So, I'm using the direct "Camera Manipulation" code example off the Roblox wiki with some small modifications.

local target = game.Players.LocalPlayer.Character.Torso
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0

while wait() do
    camera.CoordinateFrame = CFrame.new(target.Position)
                           * CFrame.Angles(0, angle, 0)
                           * CFrame.new(0, script.Position.Value, 10) 
end

My goal is this camera will be on the Player stationary. The issue is, if the player walks and turns another direction before this camera is active, the camera does not position directly in front of the character (side with the face). Sometimes it does, sometimes it doesn't depending on the rotation/position of the player before it is active.

Is there a way I can make the camera always face the front (face side) of the player?

0
The only thing I can think of is to put this before wait() marioblast1244 113 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

if I remember, use Fixed. Or what ever I think I'm not sure.

Ad

Answer this question