I have a Camera system,
Where 2 people are going against each other and a Camera follows and stays inbetween them.
I have the position done, But It doesn’t rotate the camera.
I was wondering how I would achieve it:
workspace.Part.CFrame= workspace.Part.CFrame:Lerp(CFrame.new(Vector3.new(Positon.X,Positon.Y,Positon.Z)),i)
Code above is showing how it moves, but it doesn’t rotate.
Kaid3n22
(Kaiden)
January 18, 2022, 6:51pm
#2
subtract the 2 players positions like this:
local orient = (player1.HumanoidRootPart.CFrame.Position - player2.HumanoidRootPart.CFrame.Position)
then put “orient” (or whatever you name the variable) into the orientation slot of the CFrame.new().
workspace.Part.CFrame= workspace.Part.CFrame:Lerp(CFrame.new(Vector3.new(Positon.X,Positon.Y,Positon.Z), orient),i)
1 Like
Okay, so it sorta worked,
here’s the issue.
I wan’t the side with the Decal to always be facing the players, while still moving orentionation, here’s whats happening:
Kaid3n22
(Kaiden)
January 18, 2022, 7:30pm
#4
I’m not exactly sure how to change the side that the part is looking at. But try to divide the orientation by 2 or multiply it by 2.
1 Like
Daronion
(Daronion)
January 18, 2022, 7:42pm
#5
I would do something like:
targetFocus = (player1.HumanoidRootPart.Position + player2.HumanoidRootPart.Position)/2 -- position where the camera should look
workspace.cameraPart.CFrame = CFrame.new(workspace.cameraPart.Position, targetFocus) -- camera's orientation is set here
This will make the Part always face the middle of the two players. I’m not sure if you placed the decal on the front of the Part, but you can feel free to add CFrame rotation using:
workspace.cameraPart.CFrame = CFrame.new(workspace.cameraPart.Position, targetFocus) * CFrame.Angles(xRot, yRot, zRot)