How to prevent players from sticking/sliding/glitching when pushing towards a wall?

I have a custom movement system that uses LinearVelocity. However, I’m unsure if it’s because of the mover constraint this problem is occurring.

Video example:

I’m unsure whether I need to make a custom capsule collider.

Any help is appreciated!

Where’s your math, and how are you calculating the linear velocity? How complex is your system, and how much of the default physics are you trying to override? Are you simulating friction? This post needs more information.

Sorry for the lack of information.

Currently, the movement system isn’t too complex as I’m just getting the diagonal axis right first.
I did not alter much (if not any) of the default Roblox’s humanoid. I just attached a LinearVelocity to the RootAttachment.

As for the math, I simply define a target velocity then get the delta difference from the current velocity, then “lerping” it? Sorry I’m not really sure how to explain it maybe this sample of code could suffice.

bindToRenderStep("Movement", 1, function(step)
	local moveDir = hum.MoveDirection
	local targetVelo = Vector2.new(moveDir.X, moveDir.Z) * maxSpeed
	local deltaVelo = targetVelo - linearVelo.PlaneVelocity
	linearVelo.PlaneVelocity += deltaVelo * 2.5 * step
end)

Let me know if I still left some questions unanswered :wink:

Is your leaning function actually rotating the rootpart as well? It looks like the top corner of the part is colliding into the wall. Maybe this is exaggerating the effect?

From what I’ve read though, this is actually a somewhat common Roblox issue; and since you’re not changing the Y velocity, I don’t think it’s an issue with anything you’ve written. I’m not sure what all you have respecting collisions right now, but the solution might have to be to change your collider like you said.

I am currently making the capsule collider, but I’m running into some issues as my LinearVelocity affects how the capsule behaves, and I do no know why.

All the humanoid parts have CanCollide disabled so the capsule collider is the only one responsible for the collision.

Demonstration:

As you can see, when I enable my LinearVelocity, my capsule gets stuck when a player gets in between the edges when it should’ve pushed them off. I’ve thought of applying a reflective force but I have no clue how I would detect the parts.

Do you have any idea about this? I think I will be making a separate post about this later.

Limit your player’s ability to move in mid-air by just a little bit. Doesn’t have to be a ton, but the more you do, the less they’ll be able to take advantage of the “5D force.” You probably won’t need the capsule. Why are you doing a custom movement system anyway?