PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

How to focus the camera on a specific part via code

How to focus the camera on a specific part via code

Jun 23 2018, 2:01 AM PST

Problem

You want to focus your camera on another part.

Solution

Use the CameraSubject and CameraType properties.

Workspace.CurrentCamera.CameraSubject = Workspace.Player.Head
Workspace.CurrentCamera.CameraType = Enum.CameraType.Follow

Discussion

The CameraSubject property sets what the Camera is looking at. This is set to game.Workspace.Player.Head which is what we want to look at. Then we set CameraType which is how the Camera is going to interact with its subject to be “Follow”. This way we can zoom, and rotate with the subject.

Tags:
  • camera