b5x0
(Mike_Dev)
August 27, 2020, 4:35pm
#1
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!
nicemike40
(nicemike40)
August 27, 2020, 4:53pm
#2
It looks like you’re succesfully doing that. You’ll need to be more specific about what your issue is.
b5x0
(Mike_Dev)
August 27, 2020, 5:02pm
#3
It must face the head’s front, it is not doing that. Well, it isn’t in front of the head.
nicemike40
(nicemike40)
August 27, 2020, 5:16pm
#4
FakeCamera.CFrame = SecondCamera.CFrame * CFrame.new(0, 0, -8) * CFrame.Angles(0, math.pi, 0)
Like that?
1 Like
b5x0
(Mike_Dev)
August 27, 2020, 5:47pm
#5
Yeah, exactly what I did when I changed from Position to CFrame, instead of math.pi I used the SecondCamera Orientation’s Y
Blunce
(Blunce)
August 27, 2020, 10:14pm
#6
Could you please explain what you’re doing with the CFrames here?
nicemike40
(nicemike40)
August 28, 2020, 12:37am
#7
FakeCamera.CFrame =
-- we start at the same position + rotation as the head...
SecondCamera.CFrame
-- 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)
1 Like