Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How could I implement a flashlight that works with the portals? #21

Open
NicolasRisso opened this issue May 17, 2023 · 4 comments
Open

Comments

@NicolasRisso
Copy link

NicolasRisso commented May 17, 2023

The idea is basically to make the light that gets out of the flashlight pass through the portal, or simply make the cameras in the other side of the portal have their own flashlight to give the illusion of light passage (I particularly tried this one and didn't got a smooth result , cause probably by the portal camera stoping their movement if the player is looking the portal from the sideways or looking at it's corners).

@kaitabuchi314
Copy link

Hello! If you are using lights to make a flashlight, you could make 2 lights, one for the flashlight and one coming out the other portal, pointed in a certain direction based on the original direction. I'm not very good at math, but maybe we can map the position the light hits on the portal to the other portal, then imagine if the player was there and his rotation was his original rotation but with the difference of the rotation between the forward direction of the portals added, then the new light rotation and position is the position and rotation of the hypothetical player. But don't trust that math, I don't know what the correct math is.

@kaitabuchi314
Copy link

Sorry for not reading your full issue!

@kaitabuchi314
Copy link

Can you please provide an image (not a YouTube video)?

@NicolasRisso
Copy link
Author

NicolasRisso commented Sep 20, 2023

Sure thing! I tried adding the lights to the portal camera too, but it had 2 main problems:

  1. In the border of the portal, for some reason, the camera stoped moving accordingly with the player camera (image) (image2)
  2. Some parts of the map are really close, and, since my map is dark, sometimes the lights that the portal renders in the other side is visuable. I know that level design can fix that, but I think it's an relevant point too.

I think that the portalCam probably stop moving when you look to close to the edge, maybe some fancy code could fix that, but I still think that a shader would be nicer.

imagem_2023-09-20_142906193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants