• Hey! Register here to create your account, engage with the community, and talk about what is new!

Reflections

Noah

Forum adept
Joined
Sep 7, 2020
Messages
268
Reaction score
47
I need to know how to do reflections for an upcoming project I have in mind.
 
Solution
Like, vector reflections?

So, lets say you have a laser; a beam. You have an object; a surface. So, this surface has a direction: this is called the surface normal. If there were to be a panel that is facing straight upwards, its surface normal would be the vector <0, 1, 0> (it has no x or z, only y upwards/downwards).

So, we have the surface normal. There is a setvar action "ReflectVector" under Vector Manipulation. It has an output and 2 parameters: Initial Vector (the vector of the beam), and Normal Vector (the surface normal).

Let's say the beam's vector is <1, -1, 0>. Putting this into ReflectVector with the surface normal as the other parameter should return <-1, -1, 0>. This isn't actually reflected across the...

stinkey

Forum adept
Joined
Sep 8, 2020
Messages
225
Reaction score
74
Like, vector reflections?

So, lets say you have a laser; a beam. You have an object; a surface. So, this surface has a direction: this is called the surface normal. If there were to be a panel that is facing straight upwards, its surface normal would be the vector <0, 1, 0> (it has no x or z, only y upwards/downwards).

So, we have the surface normal. There is a setvar action "ReflectVector" under Vector Manipulation. It has an output and 2 parameters: Initial Vector (the vector of the beam), and Normal Vector (the surface normal).

Let's say the beam's vector is <1, -1, 0>. Putting this into ReflectVector with the surface normal as the other parameter should return <-1, -1, 0>. This isn't actually reflected across the surface normal, however. We have to multiply this resultant vector by -1 to get the actual reflected vector.

This resultant vector, multiplied by -1, is the new direction of the beam.

If you wanted to do something like a mirror, you would have to shoot out multiple beams from the player's eye location, bounce them off any reflective surfaces, until they hit a light emitter or a solid object.
 
Solution
Top Bottom