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

How to change camera position and looking direction?

Asked by
Lineout 10
10 years ago

I'm just wondering how do you make a players camera be at a source part(p1) and the angle/direction of the camera is going toward another part(p2). I'm not trying to move the Camera itself, I want the camera to go to a position and stay there but move the direction it's looking.

1 answer

Log in to vote
0
Answered by
Marolex 45
10 years ago

what you need to do here is manipulate cameras coordinate frame to change the position and then change the cameras subject so that it looks at it.

before had we're going to change the camera type to scriptable so that the player no longer has control of the camera.

so this script is going to be inside a local script in the playerGui so that the script knows which camera to manipulate.

part1 = game.Workspace.Part1 --the cameras location
part2 = game.Workspace.Part2 --the part the camera will face
wait()
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CoordinateFrame = CFrame.new(part1.Position)
game.Workspace.CurrentCamera.CameraSubject = part2
Ad

Answer this question