Portal physics

I’ve seen this discussed numerous times before, but despite all of my efforts I’m kinda stuck here.
What I’m trying to achieve is a portal-like transition, and what I’ve tried so far is to create a trigger area around the portal and disable the collision between any filtered collider that passes through it and the wall the portal has been placed on, this way the gameobject would’ve been free to pass through the portal, a clone would’ve been created on the other side that would mimic the position and rotation of the object and once the object’s center passed through I just teleported the real object to the other side. This worked pretty well for vertical portals but I quickly ran into a problem particularly present in horizontal portals:
Whenever an object entered the trigger area the collision between the object and the floor it’s standing on would be disabled, causing the object to fall through the portal. The issue here is that this happened even if an object only partially passed through the trigger area, causing it to fall through the floor. I can’t really think of a solution that would work well for objects of any size and shape, is there something that can be done here? Pheraps a way of getting a box collider (the only kind of collider a portal can be placed on) to ignore a certain rectangle and let things pass through it?

I found a potential workaround:
I created four box colliders around the portal and set them to ignore collisions with everything by default.
Then, when an object enters the portal’s trigger and its collision with the wall/attachment is disabled, the collision with these box colliders is enabled which prevents the object from falling through the ground.
Seems to work so far even though I can see at least some issues arising from having phantom colliders floating around, but it’s good enough for now :slight_smile: