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

How do I make the player's camera look at something?

Asked by
Nep_Ryker 131
5 years ago

So, I'm trying to make a cutscene for my game and I'm trying to make the player's camera move and stuff like that. I have figured out a way on how to make it move but I still can't seem to make the camera look at the place that I want it to look at.

I have read a camera tutorial on how to make it move and look etc. And the tutorial says that to make the camera look at a specific position is to use the Focus property.

So I tried:

game.Workspace.CurrentCamera.Focus = CFrame.new(0,10,0)

But it's still not working? Can someone help me what I'm doing wrong or what I'm missing please? That'd be great :D

1 answer

Log in to vote
1
Answered by 5 years ago

Hi Xrp200,

The way to do that is to use the CFrame format of Position and LookAtPosition. It goes like this:

CFrame.new(position, position to look at)

So, you'd get the camera, and set its CFrame to the position it stays in, and the position it looks at. So, if you wanted the Camera to be at the Center of the game and look completely up. This is how you'd do that.

camera.CFrame = CFrame.new(Vector3.new(0, 0, 0), Vector3.new(0, 15, 0));

Well, I hope I helped and the above is just an example but, you just need a position for the camera to look at.

Thanks,

Best regards,

~~ KingLoneCat

0
Thank you, do you also happen to know how to lock the camera? So that the player can't move it around? Nep_Ryker 131 — 5y
0
Yeah, there's a CameraScript under PlayerScripts, when the player spawns. Just disable that. So, it's inside of the player under a folder called "PlayerScripts", and the script is called "CameraScript". Player > PlayerScripts > CameraScript. Make a .PlayerAdded function that disables that script. KingLoneCat 2642 — 5y
0
Thanks Nep_Ryker 131 — 5y
Ad

Answer this question