GMS 2 Making a portal just like in Portal games


Hi, I want to have a portal system on my game. I did one and it works. If you collide with portal A it teleports you to portal B. But I don't want to directly tp the object.
I want it to pass into portal and see half of it on portal A the other half of it on portal B while passing into portal.
While I'm doing that I don't want to just draw them. I want them to have their collisions as well.
What methods should I try for it? Is there a better way to do it other than splitting object to bunch of objects?

Thank you for your all answers.


Master of Pixel-Fu
I have also planned on doing this at some point in the future. The way I would do it is by having 2 instances of the player, since you will be able to see both of them at the same time. For the portals, I would draw the scenery behind each portal to surfaces, and draw those surfaces inside opposing portals. This way you'll see destination scenery through the portal. I am toying with the idea of showing the character facing away in one portal, and facing front in the other, as well as showing reversed movements at the destination portal, at least until the player enters it. Please share your results, and best of luck!


Raccoon Jam Host

not game maker but you could do the same ideas but in 2d, which should be a little easier as you are not having the rendering of the portals
Basically combinaison of surfaces and mask, or masks and cameras (like a CCTV system) would get you rendering the other side of the portal.
Not really an easy thing to do either in 3D or 2D, but same principle.
Bear in mind Portal was originally a tech demo at Valve by the minds behind Half-Life, so there's no real hacky way to do that, it's just very good game development, plain and simple.