Rotate Custom Rig Torso with Camera

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
image --------------------------> image image

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:

image

1 Like

Bumping because I’ve got no replies for 7 hours and I’m still stuck on this.

Sort of need to bump it again, I’ve been working on other things so I haven’t been able to figure this out still.

Additionally, it also looks like when I do the same function to the character head, it begins to be de-attached as well.

Annnnnd bumped again, no clue what is wrong with it still.

Figured something out.

Both the custom and regular rigs had differences in their CFrame values. The biggest difference were the position ones for the Motor6D:


(brought to you by paint3d)

X and Z weren’t exactly the same, so I got suspicious.
I downloaded this plugin to redo the rig entirely, comparing between the regular R15 model and the custom one.

This fixed all the problems actually, the rig now moves as it should and it no longer separates. A few animations orientated around the old rig are a little messed up, but it’s not a huge problem to fix.
I guess the guy before me didn’t make it correctly. Who knows.

1 Like