How to make a player go through a wall and then can’t go back

I want my player to go through wall or a gameobject but it is going and falling down due to rigid body I want the player to stay where it go through and it can’t go back