R15 humanoid torso collisions can cause unexpected sliding when jumping or landing

Occurs on the latest version of Roblox. This can also be reproduced in Roblox Studio. It is likely something related to physics, avatars, humanoids, and collisions.

Reproduction Steps

  1. Enter Roblox Studio on the “Baseplate” template
  2. Raise the SpawnLocation slightly off the ground
  3. Create an R15 NPC using the Animation Editor plugin (or just use your own player character), set the HRP’s CanCollide to false
  4. Enter Play mode
  5. Use the move dragger to drag your NPC or player character onto the SpawnLocation
  6. Use the move dragger to drag your NPC or player character slightly into the SpawnLocation(about halfway)
  7. Observe the NPC/player character enters an awkward sliding state and is catapulted off

More Repros

Falling

  1. Fall from a high height (~16-32 studs)
  2. Observe that occasionally you enter the floor and are flung out. You sometimes even get stuck inside the floor in a falling state until you reset.

This is more easily reproducible if you double or halve the player’s scale, but this happens on every avatar scaling size.

Jumping

  1. Jump in the direction of a platform
  2. Land in such a way that your torso barely lands on the edge
  3. Observe the humanoid enters an awkward sliding state and is catapulted off

High Velocity

  1. Fling your character (via a force constraint or BodyForce) into a platform
  2. Land in such a way that your torso barely lands on the edge
  3. Observe the humanoid enters an awkward sliding state and is catapulted off

This is more easily reproducible if you use lower gravity, but it happens in every experience regardless.

Related Bugs

These bugs likely compound this bug, but all are somewhat different.

Low client FPS causes irregular and inconsistent character collisions
I would imagine low-FPS makes this bug more noticeable.

R15 Humanoids Gain Large Amounts of Velocity When Their HumanoidRootPart Touches the Ground
This bug I am reporting occurs if the HRP is set to CanCollide false. The above bug is specifically about the HRP. It’s possible that these bugs are in the same wheelhouse (maybe due to the Humanoid and HipHeight) however I cannot concretely say.

Expected Behavior
The player lands normally. They do not sink into the ground and get flung. They do not slide on the ground until they fall off the edge of a platform.

Actual Behavior


If falling from a long height, there is an uncommon chance that the player is flung in a random direction.


If jumping into or from the edge of a platform, there is an almost guaranteed chance that the player slides off the structure or gets stuck in a permanent sliding state.

Workaround
N/A

Issue Area: Engine
Issue Type: Other
Impact: High
Frequency: Constantly
Date First Experienced: 2021-08-08 00:08:00 (-04:00)
Date Last Experienced: 2021-10-03 00:10:00 (-04:00)

5 Likes

This is related to this issue:

3 Likes

I included that it was possible they were related, but this still occurs when the HRP’s CanCollide is set to false. If the real issue is about the Humanoid and HipHeight, then it is indeed likely that these threads should be combined and renamed. I don’t feel as though I can make that call, hence why I opted for a separate thread.

1 Like

Thank you so much for putting this up, I haven’t been able to gather enough information to make a bug report but I am affected by this.

I can confirm that Low FPS has an effect on issue.

:+1:

1 Like

The first and third video are definitely Humanoid’s “my butt is caught on a corner” panic mode. Middle video is likely caused by this too.

Replied on the older thread for reference too:

Makes sense that this might happen more frequently at lower frame rates too… Humanoid floor sensor currently only steps once per frame in humanoid state machine step, so longer frames and higher velocity = more time for root part to collide during freefall before it realizes it should be standing. If I step through the video I see the character’s legs fully submerged in the ground for a frame, so I think this is what is happening. Humanoid floor sensor is supposed to increase its range when velocity is high, so I’m not sure why that isn’t helping there, we should look into that.

What’s happening in the first repro is the Humanoid is getting the spawn part stuck between the different torso parts trying to resolve the collision in different directions. Stuck in freefall, Humanoid sees something touching its butt, freaks out, and tries to panic slide out of there. I’m not sure what your platforms look like collision wise, or how your dash move works, but something like this may be happening in the last video too.

You can easily fix that one by disabling collisions on all parts except the HumanoidRootPart, that way it can’t get stuck in a conflicting collision trap. This general “caught between two collisions” problem is continually on our minds, but will take us a long time to fix.

7 Likes

Appreciate your detailed thoughts on what this issue is and what may be causing it!

For context, what would happen without the panic slide state? Would the player get stuck in the structure with no chance of escape?

As for the platform and dash logic, the platform is wedges and parts - no real gimmicks there. The dash logic is setting the HumanoidRootPart’s velocity (on the client) to a high enough number to push them in the direction you’re looking in. It works consistently. I can supply a repro if it would help you identify and solve this.

Would you have a recommendation on the most performant way to properly set avatar collisions for your proposed fix? IIRC the Humanoid will automatically set the limbs back to a default collision state, meaning I would have to constantly set the limbs to CanCollide false.

The humanoid floor sensor currently fires a few raycasts in a line in front of the humanoid, from the center of the humanoid, and from the bottom four corners of the root part. If it can’t find a floor the Humanoid goes into freefall. Of course no amount of raycasts are guaranteed to find a floor under you in all situations…

image

In a situation like this all those raycasts will miss and the Humanoid is stuck in freefall. You might be able to slide around with air control, but it looks obviously wrong. These panic forces will automatically slide the Humanoid off of that corner and allow it to fall freely, likely without you noticing the character was stuck.

If the floor sensor used shapecasts instead we wouldn’t need this, since it would never fail to find a floor that it could get stuck on. You need some kind of volume here to guarantee you won’t miss things. Unfortunately we don’t have shapecasts yet, so until then we have this workaround. Shapecasts are something we’re working on, but it won’t be ready until sometime next year, best case…

Re: avatar collisions. Set Workspace.HumanoidOnlySetCollisionsOnStateChange to Enabled.

image

Then you only need to set CanCollide in Humanoid.StateChanged instead of every frame.

Sorry. I know this stuff is a little weird and hard to work around sometimes. Let me know if you keep having trouble after simplifying collisions.

If you are able to make a consistent minimal repro for the middle video would be happy to look into that more. Are you using higher than default gravity in that one?

5 Likes

Thank you! I really appreciate the detailed explanations. I’ll give a try with modifying the collisions with these considerations and get back to you if I run into any issues.

I’ve also sent you a DM with a place file for the middle video. The default gravity is unchanged, however the player is half of their normal size. This bug still occurs even without the smaller player scale, but it occurs way more frequently and obviously. Lower FPS also intensifies these bugs, including the middle bug.

I have set Workspace.HumanoidOnlySetCollisionsOnStateChange to Enabled however when I have low FPS the bug occurs.

I do not have a repro

1 Like

Apologies for the late reply, but I finally had the chance to test the CanCollide false torso workaround.

Here are the results:
8fb82bd63afa2bf715ddc9a3e4b06289

Unfortunately it does not really work. Would you have any other suggestions?

This bug is borderline impossible to reproduce consistently with R6, but I would prefer to not convert my game into R6.

1 Like

purely speculation due to how difficult it is to reproduce this bug.

You might have to write your own custom state manager to override the built-in one.

So when inside a part set Humanoid state to not falling.

Falling state seems to be what the humanoid is stuck in and Landed state must have not fired to due low rate skipping detections

1 Like

So I applied your hypothesis, seems to check out! I decided to go for a physics-based approach at solving it, as I figured that was why R6 did not experience this bug.

This workaround works pretty well
game:GetService("Players").PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid: Humanoid = character:WaitForChild("Humanoid", 8)
		local limbs = {character:WaitForChild("RightUpperLeg", 8), character:WaitForChild("LeftUpperLeg", 8)}
		
		if humanoid then
			humanoid.StateChanged:Connect(function(oldState, newState)
				if newState == Enum.HumanoidStateType.Freefall then
					for _, limb in pairs(limbs) do
						limb.CanCollide = true
					end
					print("Legs on")
				else
					for _, limb in pairs(limbs) do
						limb.CanCollide = false
					end
					print("Legs off")
				end
			end)
		end
	end)
end)

2f29d418814bddcc4c5ce96351db80f7

Will need to clean it up, fine-tune it, and optimize - but it reduces the occurrence of this bug by a large margin with no notable downsides.

It still frequently occurs if you go straight from the “Running” to “Landed” state unfortunately. Not sure how to work around that.

1 Like