I’m quite new in doing combat systems, specially in first person, which is exactly what I want to do. When the player equips the gun it switches to first person. I’ve made it so that the “waist” 6dmotor part rotates accordingly to the camera direction. It works fine, as if I manually switch to third person the waist moves like it should in real life and keeps the same distance to the head always, as well as the arms
The thing is that when I switch to first person it seems like the camera is not attached to the head or whatever and it looks weird. Here’s a gif. What can I do to solve this and make it like an FPS?
https://gyazo.com/2d201ae2a7e86fef5dfcbd5fad493441
P.D. Here’s the code that controls this part
local waist = char:FindFirstChild("Waist", true)
local rootPart = char:WaitForChild("HumanoidRootPart")
local yOffset = waist.C0.Y
local leftShoulder = char:FindFirstChild("LeftShoulder", true)
local l_yOffset = leftShoulder.C0.Y
local rightShoulder = char:FindFirstChild("RightShoulder", true)
local r_yOffset = rightShoulder.C0.Y
game:GetService("RunService").RenderStepped:Connect(function(step)
local cameraDirection = rootPart.CFrame:toObjectSpace(camera.CFrame).lookVector
if waist and holdingGun then
waist.C0 = CFrame.new(0, yOffset, 0) * CFrame.Angles(0, -math.asin(cameraDirection.x), 0) * CFrame.Angles(math.asin(cameraDirection.y), 0, 0)
end
end)