Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

How to make people's camera look at a specific place?

Asked by
Z0Ile 687 Moderation Voter
4 months ago

Hi, I going to do something that makes people's cameras see at a specific place.

Let do some example, like the Survivor, when your team is going to eliminate someone, you'll be forced to look at a specific place, and see we're walking to the elimination hall.

I ever saw some tutorials, but it was too confusing. I know I can do it with CurrentCamera, and change the CurrentCamera angles. But- how? Do I need to use Field of View and CurrentCamera angles to change them?

Every help is appreciated. Thanks.

1 answer

Log in to vote
1
Answered by
Fifkee 1853 Administrator Moderation Voter
4 months ago
Edited 4 months ago

Set your camera's CameraType to Scriptable.

Modify it's CFrame from there:

local Camera = workspace.CurrentCamera;
local Target = workspace.Door;
Camera.CameraType = Enum.CameraType.Scriptable;
wait() --I don't know why but if you try to make immediate modifications after changing the CameraType, they will be discarded

--We'll be utilizing CFrame.new(vector3 pos1, vector3 lookat) to face the camera to the door.
Camera.CFrame = CFrame.new(Camera.CFrame.Position, Target.Position)

Field of View is simply like zooming in--it restricts or expands the field of vision depending on the current value.

Cameras have a CFrame property that allows for spatial modification.

Cheers.

0
Thanks for your answer, but it was not working, sorry :P Z0Ile 687 — 4mo
0
Just remove all the semicolons as he is thinking of JavaScript and CSS lol. PrismaticFruits 637 — 4mo
0
Semicolons are fine, they don't really impact your code that much. JavaScript doesn't require semicolons to compile. Fifkee 1853 — 4mo
0
I used var name "Door" instead of "Target," leading to an error. Fixed the issue, sorry about the inconvenience. Fifkee 1853 — 4mo
Ad

Answer this question