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

How do I orient the Camera to face the Character's Head?

Asked by
Validark 1580 Snack Break Moderation Voter
7 years ago
Edited 7 years ago

Hello, this is Validark.

Intent: Upon opening a Player's inventory, the Camera should Interpolate to face the Character's face.

It should look something like this

Attempt: So far I have some code that I arrived upon by guess and check, which can be seen below. It works for simply setting the CFrame of the Camera, but doesn't work as intended with the Interpolate method. The code below does produce a desirable result, but I'm open to suggestions

local Head = workspace.Bot.Head
local CurrentCamera = workspace.CurrentCamera
CurrentCamera.CameraType = "Scriptable"
local a = Head.CFrame.lookVector * -999
CurrentCamera.CFrame = CFrame.new(Head.CFrame.p, Vector3.new(a.X, CurrentCamera.CFrame.Y, a.Z)) * CFrame.new(0,-1, 8) * CFrame.Angles(0, math.pi / 5, 0)

Any help is appreciated. I am not a CFrame expert by any means.

Answer this question