Hey folks, recently I’ve been trying to make a function that causes the player’s torso to move with your camera when you look up and down.
Here’s the code:
--Local Script in StarterPlayerScripts.
local NewCFrame, NewCFrameAngle, Asin = CFrame.new, CFrame.Angles, math.asin
local Neck = Character:FindFirstChild("Neck", true)
local OriginalNeckOffsets = NewCFrame(Neck.C0.X, Neck.C0.Y, Neck.C0.Z)
local Waist = Character:FindFirstChild("Waist", true)
local OriginalWaistOffSets = NewCFrame(Waist.C0.X, Waist.C0.Y, Waist.C0.Z)
local RunService = game:GetService("RunService")
function BindMoveTorso()
--local SavedValue = CFrame.new(0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
local OffsetX = Waist.C0.X
local OffsetZ = Waist.C0.Z
local OffsetY = Waist.C0.Y
RunService:BindToRenderStep("MoveTorso", Enum.RenderPriority.Camera.Value, function()
local CameraDirection = HumanoidRootPart.CFrame:ToObjectSpace(Camera.CFrame).LookVector
if Waist then
Waist.C0 = NewCFrame(0, OffsetY, 0) * NewCFrameAngle(Asin(CameraDirection.Y) / 2.5, 0, 0)
end
end)
end
wait(10)
BindMoveTorso()
And here’s the problem:
I’m using a custom rig, normally that wouldn’t be a problem, but apparently this makes this function harder to really use. Here’s why:
Regular R15 ---------------------------------------- Custom R15
-------------------------->
In regular R15, it obviously follows the Lower Torso and doesn’t really de-attach.
However, the custom R15 rig de-attaches from the torso completely. It’s weird, and I have no idea really to fix it. I’ll include the Custom Rig here:
Rig.rbxm (12.4 KB)
Also, here’s the difference between both regular and custom: