-
Notifications
You must be signed in to change notification settings - Fork 174
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
Comments
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. |
Sorry for not reading your full issue! |
Can you please provide an image (not a YouTube video)? |
Sure thing! I tried adding the lights to the portal camera too, but it had 2 main problems:
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. |
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).
The text was updated successfully, but these errors were encountered: