wall contact

For example, when the player approaches the walls and comes to the walls, the player is waiting at the door, her right or left hand will touch the wall, how can I make wall contact, just like in the previous game?