Collision Groups Causing Me A Headache

Hello developers,

Today I come to you in need of assistance. I have a simple problem with what I assume to be a simple solution. I have 2 ‘torsos’ in a character. “LowerTorso” for standing and “Torso”, a pancake shape I weld to them to be used as a collision box when they’re crawling.

When standing, the LowerTorso is collision group 1 and Torso is collision group 2. I’ve set these groups up so that group 1 will not collide with other group 1 parts and group 1 will not collide with group 2. Group 2 will not collide with default as well. Everything is fine here.

The problem arises when you crawl. LowerTorso becomes group 2. Excellent. Torso becomes group 1, great. Supposedly, the LowerTorso should now go through things and the Torso should collide. But that’s not what happens. Inexplicably, your whole character goes right through things, even though I’ve confirmed that both parts have the proper collision group ids that they’re supposed to. I’ve even tried renaming Torso to no avail. Setting them locally or on the server changes nothing.

Do you guys have any idea what’s going on? Why does my collision system work in one case but not the other? I appreciate any and all help!

1 Like

Could you post the code so I could get a grasp of what’s going on?

Sure, here’s the code.

function SetCharacterCollision(char, standing)
	local newGroup, oldGroup = "CharacterParts", "SpecialCaseParts"
	local newPartList = {LowerTorso = true}
	local oldPartList = {Torso = true}
	if not standing then --crawling
		newPartList = {Torso = true}
		oldPartList = {LowerTorso = true}
	for _,v in pairs(char:GetChildren()) do
		if v:IsA("BasePart") and v ~= char.PrimaryPart then
			if newPartList[v.Name] then
				PhyService:SetPartCollisionGroup(v, newGroup)
			elseif oldPartList[v.Name] then
				PhyService:SetPartCollisionGroup(v, oldGroup)

That’s all I got unfortunately. Like I said in the original post, the items have the CollosionGroupIds that they’re supposed to in both cases, but in crawling you just go right through stuff for some reason, even if I manually set the Torso’s collisiongroupid to 1 in the Server.

Is it possible it’s because in new part list you’ve only defined the Torso field, and in R15 the upper torso is called, well, UpperTorso? Also I presume you mean to have if v:IsA("BasePart") and v ~= char.PrimaryPart then & not if v:IsA("BasePart") v ~= char.PrimaryPart then

1 Like

Could you show the collision group initialization? Defining what it can collide with and everything.

Also, I doubt this is the issue, but are you sure your Torso is CanCollide?

1 Like

Sure, here it is.

PhysicsService:CreateCollisionGroup("CharacterParts") --where parts meant to collide are put
PhysicsService:CreateCollisionGroup("SpecialCaseParts") --where parts not meant to collide are put
PhysicsService:CollisionGroupSetCollidable("CharacterParts", "CharacterParts", false)
PhysicsService:CollisionGroupSetCollidable("SpecialCaseParts", "SpecialCaseParts", false)
PhysicsService:CollisionGroupSetCollidable("SpecialCaseParts", "Default", false)
PhysicsService:CollisionGroupSetCollidable("SpecialCaseParts", "CharacterParts", false)

And yes, the Torso is CanCollide.


Yeah that was an error, deleted the and accidentally. As for the name “Torso”, apparently not because if I just name it “FakeTorso” it has the same problem.

I tried to reproduce this and was unable to. There might be some weird humanoid behavior going on possibly.

Could you put the crouching and everything into a seperate repro file and send it here?

1 Like

I don’t understand how this part could be in the collision group and just not collide. Even when I call it “Part” or something it still has that problem. I’ve welded it to the HumanoidRootPart btw.

I’m gonna have to do some weird experiments to figure out what the issue here, this doesn’t make sense.

How exactly do you do the crawling part of it? That might have something to do with it’s the only real thing that is majorly different from my testing (which doesn’t have this issue) and your code. Do you use animations, or modify Motor6Ds?

1 Like

I use animations. The entirety of the code I use to change collision states can be found in my response above with function SetCharacterCollision

Also, new behavior I’ve just noticed. If I’m walking into a wall and I go into crawling mode, the new collisions work but only for like 1 second. Check it out. There is nothing changing the collision mode or CanCollide when this happens.
I’ve eliminated the possibilities of the Head or UpperTorso being to blame for this weird behavior

This may not solve the issue, but could you try parenting the block outside of the character?

1 Like

Mind showing us the code that handles the crouching logic itself?

1 Like

Thanks for the suggestions! Unfortunately it still does the same thing however.

@thatsaniceROOT I’m not entirely sure if anything in that code could be causing that, since the Torso’s collisiongroupid and CanCollide status stay the same even when it starts to phase through things. But here you go so you can look it over if you want. The full code pertaining the collisions and state changing. The player will press X or C to go into prone or crouch respectively (we’ll ignore the crouch state here since nothing changes there except the animation). ChangeState initiates, then goes to ChangeSpeed, then goes to SetCharacterCollision, the true or false part being whether or not they are now standing (false if prone).


I’ve discovered that, for some odd reason, the UpperTorso and Torso parts are linked together in their collision states. When in prone, the UpperTorso is meant to be in collision group 2 (collides with nothing) and the Torso is meant to be in collision group 1 (collides with the world, minus players). They are both in those groups, however Torso collides with nothing even though it’s in group 1. Check the MP4 in my reply above to see that it works, but only for 1 second before it goes through things.

When I change UpperTorso to collision group 1 however, the Torso is suddenly able to collide with things too. This happens regardless of what “Torso”'s name is. Check the MP4 below to see. Keep in mind that the gray disk part that suddenly becomes able to collide is Torso. In this video I am changing the collision group of UpperTorso. I’m completely at a loss here. I appreciate any and all replies, because I am unable to find the bug here.