Search Unity

Player sticking to walls in 2D Platformer

Discussion in '2D' started by JohnnyMc, Nov 21, 2015.

  1. JohnnyMc

    JohnnyMc

    Joined:
    Apr 28, 2015
    Posts:
    64
    I'm making a 2D platformer game much like the original Mario Bros. When my player hits a floating box he gets stuck for a minute before sliding off of it. I was watching a video about a month ago and saw an easy fix for this but I have spend the last hour on youtube looking for that and can not find it. Can someone tell me or point me to the fix? I thought it was just a friction setting somewhere but I cant seem to find the solution.

    Thanks
     
  2. SolidSwiftie

    SolidSwiftie

    Joined:
    Nov 24, 2015
    Posts:
    1
    http://prntscr.com/968t6w

    Create a Physics 2D Material, set the friction to 0 and attach it to the Box Collider where it says 'Material' on your Player

    Not sure if you've figured it out yet, but there ya go!
     
    HakeemLukka likes this.
  3. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    you want to detect if the player is next to a wall, then you want to stop any velocity in this direction if you'd like the player to slide down smoothly.
     
  4. ImCallMeEcho

    ImCallMeEcho

    Joined:
    Dec 19, 2021
    Posts:
    1
    This is a really old post but i have to say: THANK YOU SO FREAKING MUCH