Still have questions? Join our Discord server and get real time help.
1

# How to move camera to side of player?

A_thruZ 29
1 year ago

I am trying to make a Fortnite style game, and I want a third person view from the left side. I've tried this in a LocalScript:

local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character

while cam.CameraSubject == nil do
wait(1)
end

while wait() do
cam.CFrame = cam.CameraSubject.Parent.UpperTorso.CFrame * CFrame.new(Vector3.new(5,0,0))
end


Any shape, form, or camera style of help would be appreciated!

0
So.. I have another problem related to this post, and I need the player to look towards the mouse, like in the first person view, but still be in first person. I tried using CameraMode under Humanoid and set it to LockFirstPerson, it worked, but if you tried to zoom in, you get stuck in first person. A_thruZ 29 — 1y

1

Hello! I see that you are facing troubles using camera. Well that is no problem because I am here to help.

What you have here is pretty much right, you are just missing one vital thing. Whenever you want to manipulate the camera with your scripts, you must change the CameraType. CameraType is a property of camera that changes around how the camera behaves. In order to move the camera on to the side of the play you must use the "Scriptable" type. So using your code here, we are going to edit it a bit:

local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character

while cam.CameraSubject == nil do
wait(1)
end

cam.CameraType = "Scriptable"
while wait() do
cam.CFrame = cam.CameraSubject.Parent.UpperTorso.CFrame * CFrame.new(Vector3.new(5,0,0))
end



Now technically, that would make your code work just as intended, but I'm going to help you out with a few edits. First off, we are going to implement RenderStepped. RenderStepped fires every time a new frame is rendered. This means that to get the smoothest camera action, we would want to use it because it happens e very frame rather than every .03 seconds. Another thing is that you are linking the camera to the upper torso. This creates a very jittery camera motion because it's cframing relative to the UpperTorso, and the UpperTorso moves because of animations. To combat this we can simply use the Character's HumanoidRootPart as the reference point.

local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character

while cam.CameraSubject == nil do
wait(1)
end

cam.CameraType = "Scriptable"
game:GetService("RunService").RenderStepped:connect(function()
cam.CFrame = cam.CameraSubject.Parent.HumanoidRootPart.CFrame * CFrame.new(Vector3.new(5,0,3))
end



Also your camera was only off to the side, so I also moved it back on the Z axis 3 ish studs, but feel free to edit that around until it's comfortable for you :D

Thus creates a nifty camera system.

~Lone

3
User#5423 -10
1 year ago

You can set the camera view offset under the humanoid.

example

humanoid.CameraOffset = Vector3.new(-2, 0, -2)


wiki page is down atm so cannot link it :/

0
Ok, I'm guessing that's new? I'll try it out! Thanks! A_thruZ 29 — 1y
0
It really is old lol but often overlooked User#5423 -10 — 1y