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

Simple camera manipulation?

Asked by 9 years ago

So, I'm making a menu gui and I want a camera to look at a certain hallway. I want it to be type scriptable so users cant pan the camera, but I'm running into multiple issues.

local target = workspace.CameraPart
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
  1. The camera is still able to pan, even though it is scriptable
  2. I have no idea how to position it

Any help would be amazing. Thanks!

1 answer

Log in to vote
0
Answered by
Joeypm1 10
9 years ago

Simple problem, I had trouble with it once too. Here's what you do:

local target = workspace.CameraPart
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = target.CFrame

The "Scriptable" CameraType does not work with CameraSubject. You need to use the CoordinateFrame property instead. CFrame is short for CoordinateFrame. So instead of using camera.CameraSubject use camera.CoordinateFrame and instead of putting "target" or the subject you want, use target.CFrame. If you want to edit the positions with it, do this:

local target = workspace.CameraPart
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = CFrame.new(target.CFrame.X + number,target.CFrame.Y + number,target.CFrame.Z + number)

edit the "number"s to what you want.

Ad

Answer this question