Ragdoll physics be weird

hey guys, I’m making a second post on ragdolling because it’s so wonky :sob:
my ragdoll right now is always experiencing seizures, and I’m not sure what’s up with it

my first problem is with the head glitching(?) out on the floor (green parts are the collisions)

my second problem is with the collisions, I’ve tried a block collision and a pill collision, but both yielded the same results, as seen from the video above. I’ve also experienced a bug where it doesn’t fully touch the ground


this is the code I’ve used for the collision in the picture

modulescript code I wrote
local players = game:GetService("Players")
local repStorage = game:GetService("ReplicatedStorage")

local ragdollService = {}

local attachmentName = "BallSocketAttachment"
local bSocketConstraint = repStorage:WaitForChild("BallSocketConstraint")

local bodyPartSizes = {
	["Head"] = Vector3.new(0.8, 0.8, 0.8),
	["Torso"] = Vector3.new(1.8, 1.8, 0.8),
	["Right Arm"] = Vector3.new(0.8, 1.8, 0.8),
	["Left Arm"] = Vector3.new(0.8, 1.8, 0.8),
	["Right Leg"] = Vector3.new(0.8, 1.8, 0.8),
	["Left Leg"] = Vector3.new(0.8, 1.8, 0.8)
}

--Local functions
local function getMotor6Ds(character) : Motor6D
	local listofMotors:Motor6D = {}
	
	for _, v in character:GetDescendants() do
		if v:IsA("Motor6D") and v.Parent == character:FindFirstChild("Torso") then
			table.insert(listofMotors, v)
		end
	end
	
	return listofMotors
end


--Service functions
function ragdollService:BuildCollisions(character)
	for bodyPart, size in bodyPartSizes do
		if character:WaitForChild(bodyPart) then
			local selectedPart = character:WaitForChild(bodyPart)
			
			local newCollision = Instance.new("Part")
			local newWeld = Instance.new("WeldConstraint")

			newCollision.Size = size
			newCollision.CFrame = selectedPart.CFrame
			newCollision.Transparency = 1
			newCollision.CollisionGroup = "RagdollCollision"
			newCollision.Parent = selectedPart
			
			newWeld.Parent = newCollision
			newWeld.Part0 = selectedPart
			newWeld.Part1 = newCollision
		end
	end
	
end

function ragdollService:RagdollInit(player)
	local char = player.Character or player.CharacterAdded:Wait()
	local torso = char:WaitForChild("Torso")
	local humanoid:Humanoid = char:WaitForChild("Humanoid")
	
	--Disabling RequiresNeck
	humanoid.RequiresNeck = false
	humanoid.BreakJointsOnDeath = false
end

function ragdollService:ReplaceJoints(player)
	local char = player.Character or player.CharacterAdded:Wait()
	local humanoid:Humanoid = char:WaitForChild("Humanoid")
	
	local motors = getMotor6Ds(char)
	
	--To prevent moving during ragdoll
	humanoid.PlatformStand = true
	humanoid.AutoRotate = false
	
	for name, motor in motors do
		local attach1, attach2 = Instance.new("Attachment"), Instance.new("Attachment")
		local bSocketClone = bSocketConstraint:Clone()
		
		attach1.Name, attach2.Name = attachmentName, attachmentName
		
		attach1.CFrame = motor.C0
		attach2.CFrame = motor.C1
		attach1.Parent = motor.Part0
		attach2.Parent = motor.Part1
		
		motor.Enabled = false
		
		bSocketClone.Attachment0 = attach1
		bSocketClone.Attachment1 = attach2
		bSocketClone.Parent = motor.Part1
		
		if name == "Right Hip" then
			attach1.Position = Vector3.new(0.5, -1, 0)
		elseif name == "Left Hip" then
			attach1.Position = Vector3.new(-0.5, -1, 0)
		end
 	end
	
end

return ragdollService

if anybody has any solutions, please help me out! thank you so much…

1 Like

how are you making the ragdoll… ragdoll??? we cant help you without that info

Video link not working, maybe upload it there

sorry, I made this post late at night and was too sleepy HAHA
I edited my original post to include details

1 Like

bumping, I really need help with this

Why bother with collisions? Just set .CanCollide to true on every bodypart except hroot

wait a sec, this somehow… worked? I might need to experiment with this a bit more, but still it’s pretty ok
one last thing, how do I prevent my head from discombobulating?

my properties for the BallSocketConstraint:

Disable limits for head and see how it acts

he’s dead, you killed him


You still got limits enabled in the pic

oh my bad, but this is still how it looks like
the Gudetama is on my back, and my head still somehow rotates behind it

hmm how it works if you don’t interfere with can collides

Okay then try some limits on head but disable its collisions

the problem is that it’s head right now can rotate to behind, and it’s only having the option of how far the head can rotate downwards/upwards

Oh i forgot something do you set humanoid’s state to physics when ragdolling?

oh, I haven’t done that, what does it actually do? I’m still unsure with the solutions given online

I need help with this, I’m still looking for a solution somehow

Actually your script is actually set up in a pretty good way for a base. But I’m noticing something pretty big, the last time I checked; Motor6Ds don’t apply to R6 rigs. However, I could be wrong and be confusing this with joints. Another thing you can probably do is set the ‘selectedPart’ to have no CanCollide. One thing to note, I don’t do R6 ragdoll often as of right now, so if this doesn’t work I thoroughly apologize.

Inside of:

if character:WaitForChild(bodyPart) then
			local selectedPart = character:WaitForChild(bodyPart)
			
			local newCollision = Instance.new("Part")
			local newWeld = Instance.new("WeldConstraint")

			newCollision.Size = size
			newCollision.CFrame = selectedPart.CFrame
			newCollision.Transparency = 1
			newCollision.CollisionGroup = "RagdollCollision"
			newCollision.Parent = selectedPart
			
			newWeld.Parent = newCollision
			newWeld.Part0 = selectedPart
			newWeld.Part1 = newCollision
		end

try putting something maybe at the end of that if statement to disable collisions for selectedPart, but keep the newCollision collision property the same.

Again, I apologize if none of these solutions work. It would be nice if you could keep us updated.

hey, thanks for the complimenting me for good code :happy3:
anyway, Motor6Ds definitely does apply to R6 rigs, and always has been (I think). I’ve tried your solution, but it resulted in the same collisions