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

How Would I Focus The Camera?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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

alternatively to the previous; you can also usecamera.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)
Ad

Answer this question