Attachment not translating well with camera CFrame orientation

So i have these two snippets of code in which they control the camera.

-- CLIENT --
while true do 
	local X,Y,Z = Camera.CFrame:ToOrientation()
-- SERVER --
CAMERAROTRECIEVE:Connect(function(pl, Rotation: CFrame)
	local PositionONLY = TorsoAttachment.CFrame.Position
	local newCFrame = * Rotation
	TorsoAttachment.CFrame = newCFrame

the problem is that the rotation does NOT translate well with the camera orientation.

1 Like

“* Rotation” actually ads position to the cframe instead of rotation. What you could do instead is give the Camera.CFrame.LookVector and reconstruct the cframe as

newCFrame = CFrame.lookAlong(PositionONLY, CameraLookVector)

tried this solution out, it did fix some problems, but its inverted (no clue how to un-invert the thing).

EDIT: I got it fixed by making the X and Z axis negative, thank you!

Yaaay, Camera’s look vector is the direction the camera is pointing to, if you want the opposite then it would be negative, like -Camera.CFrame.LookVector.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.