CameraFocus on a Part Breaks Shift Lock

I have a part that welds itself to a players’s head when they join, and the Camera is focused on that part.

However, the part doesn’t face the direction of the camera when shift lock is enabled, so that makes shift lock a little wacky.

I assume a way to fix this would be to make the part rotate in the direction of the camera, but I don’t really know how to do that.

3 Likes

Try setting the camera.CameraSubject to the part.

The part already is the CameraSubject.

Is there a reason why this is? If you set it to the humanoid it should work.

Yes actually. I’m making a ragdoll system and whenever a player is being ragdolled, the camera starts spazzing. I’m trying to make a new camera subject that won’t be affect by the ragdoll to fix the spazzing issue.

Try turning CanCollide off on the part, maybe the camera is colliding with the part and I think that should fix it.

CanCollide is off. I also tried CanTouch and CanQuery.

Figured it out!!!

--put this in a localscript
local plr = game:GetService("Players").LocalPlayer;
local char = plr.Character or plr.CharacterAdded:Wait();
local camera = workspace.CurrentCamera;
camera.CameraSubject = char.Part; --makes the camerasubject the part in the character
game:GetService("RunService").RenderStepped:Connect(function()
	if game:GetService("UserInputService").MouseBehavior == Enum.MouseBehavior.LockCenter then
		local x, y, z = camera.CFrame:ToOrientation() --gets xyz of the camera orientation
		char.Part.CFrame = CFrame.new(char.Part.CFrame.p) * CFrame.Angles(0, y, 0) --sets y orientation of part to camera's y orientation
	end
end)

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