I know I am probably beating dead horse here, but couldn’t google out it. My character has 100% physics-based movement, done with a rigid body. Said rigidbody never rotates (aside of Y axis) due constraints. Unfortunately, when I jump towards a wall, rigid body sticks until I release forward button. Tried to make physic materials, but unfortunately it doesn’t work.
stop adding force when its off the ground.
But then it won’t maneuverable in the air. This is a colorful 3D platformer, with things like double jumps and mid-air U-turns, not hyperrealistic military shooter with brown and gritty graphics.
The only solution you have is to not apply force in the direction of the wall… how you do that is your choice.
Ah, fudge it. Since it doesn’t affect movement too much, I’ll just include this as “feature” in character’s moveset. Also works quite nicely when moving on the wall, so…
Good idea. if only we could do that with everything
This is a normal issue - out of the box, things that hit a wall in the air won’t slide down it if it’s getting force applied in the direction of the wall. The easiest fix is to do a raycast in the direction of your input, and null out the horizontal velocity if you’re adjacent to a wall in that direction.
You should also put your player character on continous dynamic collision detection, as that’ll prevent it from clipping slightly into walls and the ground on the frame the character hits those things.
For anyone else running into this issue, as I have a thousand times, I finally found a virtually perfect solution. On the character with the Rigidbody, you will also have a collider (usually a capsule collider). Copy that component, make the copy slightly wider, and slightly shorter, than the original. Match the height of the original, and then put the frictionless material on this collider. Now, the “feet” of your character will have the friction of the original capsule (you won’t slide down slopes) but the “walls” of the new capsule will be what collides with other wall objects, and you will slide down them correctly.
No need for any extra coding, raycasts, etc. Enjoy!
Oh wow… I could hug you now. After 4 years of bumbling work arounds… this was the simplest and “most elegant”… thanks man
@GreenSimpleGames thank you! Brilliant, simple, effective solution!
I made my extra capsule just a tiny bit shorter (height) so there’s a circular contact area rather than a single contact point for the friction collision. I found this helps when going up ramps with a Y ‘locked’ character (otherwise the touch point was zero friction being slightly forward of the very bottom).
What do you mean by “Match the height of the original?” I’m having trouble getting this to work and I think I’m misunderstanding
When you duplicate the capsule collider, you adjust the height of the duplicate to be a little shorter than the original one, but at the same Y offset, also make the radius a bit larger.
What you’re doing is putting a frictionless ‘shell’ around the outside of the original capsule except at the very bottom and top.
The original capsule gives your feet some friction so you don’t slide on ice all the time but it also sticks to walls. The new capsule will slide down walls, so having the original sticking out a little bit at the bottom means you get both:
- feet with friction
- body not sticking to walls!
AH, I understand now. Thank you! Can’t wait to give this a shot.
Thanks for this beautiful and easy to apply solution.
I like to add that you should apply the “Minimum” “Friction Combine”-option.
Without it i still had the sticking to the wall problem.
Thank you. <3 You saved my hours.
saved, ty
i love you, this solution saved me. i hope everyone who has this problem sees this answer