Iโm not entirely sure that physics is possible, but you should be able to interact with the bit mask to collide with the physical body during the game in order to achieve a similar effect.
So, you have the door open, and when it detects that the player is touching it *, it changes the bit mask so that the player collides with it. This should allow the player to go one way, but not return.
* In fact, find the door when the player no longer touches the door through the playerโs physical body, and check the location of x or y depending on whether it is a hatch door or an ordinary door. If the location is far enough from the door, change the bit matrix of the door collision so that the player cannot pass.
source share