I’m trying to achieve a goal which is positioning a part (Camera) depending on the Player’s head position, this is what it looks:
My current Part positioning:
local SecondCamera = game.Players.LocalPlayer.Character.Head
FakeCamera.Position = Vector3.new(SecondCamera.Position.X+8,SecondCamera.Position.Y,SecondCamera.Position.Z)
FakeCamera.CFrame = CFrame.new(FakeCamera.Position,SecondCamera.Position)
Any suggestions are appreciated!
It looks like you’re succesfully doing that. You’ll need to be more specific about what your issue is.
It must face the head’s front, it is not doing that. Well, it isn’t in front of the head.
FakeCamera.CFrame = SecondCamera.CFrame * CFrame.new(0, 0, -8) * CFrame.Angles(0, math.pi, 0)
Yeah, exactly what I did when I changed from Position to CFrame, instead of math.pi I used the SecondCamera Orientation’s Y
Could you please explain what you’re doing with the CFrames here?
-- we start at the same position + rotation as the head...
-- nudge it forward (-Z axis) by 8 studs (the * operator is relative to the rotation)
* CFrame.new(0, 0, -8)
-- and spin it around 180 degrees on the Y-axis.
-- math.pi is 180 degrees in radians (i.e. math.rad(180))
* CFrame.Angles(0, math.pi, 0)