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

How to use a part as a camera?

I'm basically trying to make the camera face whichever way a part is faced and positioned.

I've managed to get the camera to be positioned where the part is, but I can't figure out how to face the camera in the direction that the part is facing. I tried setting the camera rotation to equal that of the part, but the camera loves to stay focused on my character. I've also tried changing the CameraSubject to that of the part- as well as changing the camera type- with no luck. Any suggestions?

My Code:

camera  = game.Workspace.CurrentCamera
CamPart = game.Workspace.CamPart

position = CamPart.Position
rotation = CamPart.Rotation

camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame     = CFrame.new(position, rotation)

1 answer

✓ Accepted answer

Simply set the camera CFrame to the CamPart's CFrame. CFrames carry over rotations.

camera  = game.Workspace.CurrentCamera
CamPart = game.Workspace.CamPart

camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CamPart.CFrame

3 comments

0

This answer sounded promising! However, the look vector still changes to point towards where my character spawns upon pressing play. The only thing I could think of that's causing this is that the CameraSubject is set to my Humanoid before changing to CamPart

0

I see you edited your post, and that seemed to work! Thank you!

0

Yup, np

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