- Home /
Why do sprites stick to each other?
I am making a 2D platformer and I've run into a problem: When my character jumps into a wall and you keep him moving against it he is supposed to fall down, however, he actually sticks there and can hang indefinitely as long as you keep moving the character against the wall. I think this has something to do with friction mechanics in the physics engine. It should also be noted that the character in my game can move in the air while jumping (similar to Super Mario and other 2D platformers) so he only sticks when you're holding the button to move him in the direction of the wall. So is this a matter of lowering friction (and how would i do that) or is this something else? Thank You!
Answer by maikonfarias · Jun 25, 2014 at 10:01 PM
If you are using the standard 2d character controller, you can add the Slippery material to the Box Collider 2D in walls.
If you can't find the materials for colliders, here is the one I am using: http://maikonfarias.com/unity/samples/Slippery.physicsMaterial2D
Download Slippery.physicsMaterial2D file and import to unity.
put it in the "Material" property of a Collider 2D for your walls.
I ended up not using the code you were using and ins$$anonymous$$d I went to Assets > Create > Physics$$anonymous$$aterial2D and simply changed the friction variable to 0 from the inspector. Great answer anyway though.
I changed physics$$anonymous$$aterial2D friction variable to 0 from the inspector and apply to wall as well as character.
Still character strucks while jumping between walls ( if character collider touches the wall collider edge)
Your answer
Follow this Question
Related Questions
2D character controller getting stuck on walls 5 Answers
Triggering platform animation on colliding with Button 0 Answers
2D Character Movement Collision Problem 0 Answers
How to add knockback to a player and when releasing the joystick not stopping knockback force 2 Answers
Drag Player Object using Physics 2D 0 Answers