make Portals and Lasers behave
so, i got lazers and "portals", as shown in this video: https://youtu.be/CXIjGzVoAAs
im trying to get the relative position of the laser and angle against the portal. so it gets sent to the other side.
but i dont know where to start or how to detect the relative position.
what i want to do, is to detect the relative position and rotation of the lazer hitting the blue portal and send it to the orange one.
-
It's a bit of a complex topic, and required maths to figure out from the direction of the laser, combined with the direction of the portal, convert it using the direction of the other portal, to get a new direction for the laser on the other side. It's doable, but you have to make the maths for it. So you can Google that to learn about how that works.
Here's one video I found helpful to learn what dot products are and how to calculate them--which is used to turn global directions etc. into local ones and back again basically. So that'll be a big part of it. https://youtu.be/MOYiVLEnhrw?t=8781
I also have a "daydream" article on patreon, which explains how to display a laser bouncing off of a surface. The maths will be roughly the same, but expanded to take the second portal into account. https://www.patreon.com/posts/laser-reflection-53063121
Please sign in to leave a comment.