How do i keep control offset after teleporting in any portal

Hi, I need help with rotation math. In my game I have cubes with custom gravity and portals which can be placed in any orientation.

Right now they work like this: I set my actor player new location from target portal, then rotate actor player by make rot from axis of target portal and then i want to make right control rotation, not just facing forward exiting a portal, but if i entered from an angle - exit from the same angle.

I know for portals placed only vertically it could be smth like - delta from control rot and portals forward vector rotator but I struggle to make it for all directions. I tried to somehow make an offset and apply it after but failed miserably..

Hi, I am assuming this doesn’t relate to the gamedev tv courses?

Generally the forum is limited to our course support