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 face the Camera's Focus?

Asked by 6 years ago

I'm looking to make a script that is just like the Shift Lock, except the player is located in the center as normal. Can someone take me through the process of how this is done?

Any comments/answers will help. ~SkeletalReality

1 answer

Log in to vote
1
Answered by
DanzLua 2879 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Well we can either use a bodygyro and CFrame for this, i'd go with bodygyro

BodyGyro create a bodygyro and change its 'cframe'

local position = workspace.CurrentCamera.Focus.p

local bg = Instance.new("BodyGyro")
bg.cframe=CFrame.new(position)
bg.Parent=character.HumanoidRootPart

now you have to take in account that you'll have to change position and update the bodygyro whenever the camera moves

CFrame change the cframe of the model using :SetPrimaryPartCFrame and making the direction the position of focus

local position = workspace.CurrentCamera.Focus.p

character:SetPrimaryPartCFrame(CFrame.new(character:GetPrimaryPartCFrame).p, position)

same thing as the other method these scripts are not complete and you need to update this when the camera moves to the character is always rotated to the focus if thats what you want

Ad

Answer this question