Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How Would I Focus The Camera?

I am triyng to make a 3D side scroller but I am stuck on camera manipulation. I followed the wiki page but still get no result. When I run the script the camera is not manipulated but I get no errors. I have this localscript in StarterGui. I aslo put it in a regular script and put it in the workpsace but get the same result.

local cam = workspace.CurrentCamera
local cb = workspace.CameraBrick

cam.CameraSubject = cb
cam.CameraType = Enum.CameraType.Track

1 answer

✓ Accepted answer

you can use the camera.Focus property of camera to make it look in a certain direction

alternatively to the previous; you can also use camera.CFrame to decide where you want the camera to look by doing this

camera.CFrame =  CFrame.new(position of the camera in vector 3, positon of where the camera should look in vector3 also)

example:

camera.CFrame =  CFrame.new(Vector3.new(0,10,0),Vector3.new(0,1,0))

the previous code puts camera at position 0,10,0 and makes it look at position 0,1,0 (which is just under it)

you can make the same effect using camera.Focus like this

camera.CFrame =  CFrame.new(0,10,0)
camera.Focus = Vector3.new(0,1,0)

This discussion is preserved as it was. New answers, comments, and votes are closed.