Working on Portals : 2 : Fixing Portal Blindness
The portals have a problem: They blind you when you enter them.
Why does this happen? The portals are fine until you're right up in them:
It's because of the way the PortalViewer samples the portals. It does raycasts from it to the portal surface to tell if there's any walls in the way. The positions of these raycasts are , say 1/10 from one edge of the portal to the other, 2/10 of the way, 3/10, 4/10, etc., all the way until the other edge of the portal. (by 'edge', I mean from, say, in a door, the hinge to the doorknob). That explains why it clips the end of the room off. When it is right close to the door, all the raycasts are off to one side or the other, with none going forwards.

The proper way to position the raycasts is for the PortalViewer to get the angles from one side to the other, and iterate over 1/nth of that angle each time.

This way also gives the benefit of not shooting a hundred rays ar a door that's far away; if the angle is small relative to tht PortalViewer, only a few rays will be used.
Hope to have the demo out soon! :D
2d Portal Demo
Demo for 2d portals in Unity
Status | In development |
Category | Tool |
Author | InsanityOnAMachine |
Tags | 2D, mind-bending, No AI, non-eucledian, Top-Down |
Languages | English |
More posts
- Portal Demo 0.6 is out!16 days ago
- Working on Portals : 3 : Picture-in-Picture18 days ago
- v 0.519 days ago
- Working on Portals : 120 days ago
Leave a comment
Log in with itch.io to leave a comment.