reflecting one vector on another vector

G

Guest

Guest
I am making a 3d game and want a ball to bounce off corectly any surface that it hits. I want to make a function to do the math for this. As input, I will have the current vector of the ball, and the vector of the surface that it hit. As output, I want to have the resulting vector of the ball.

So, how do you reflect a 3d vector on another 3d vector?

I have writen down a bunch of inputs and outputs, and tried to find a way to get to the output, but couldn't think of anything. I tried to find paterns, and found a bout a million, but there always seemed to be at least one peice of evidence that would prove that patern wrong. I have looked on the internet for an equation that would do this, and found two sites that refrenced the same equation, but I am not sure I understood how to use the equation properly, because it did not work for all of my number sets.

Thanks in advance for any help!
 
Thanks for the article and links that it has. They were very enlightening and helped me to understand some things better, mabe I am blind, but I could not find how to reflect a vector on another vector anywere in those pages. Anybody know how to do this?
 
Ok, so if a ball has a vector of 1,1,0; and the plane that it hits has a vector of -1,-1,1; what will the balls vector be once it bounces off?
I thought that it would be -1,1,1. Is that right?
Please answer!
 
This link has the formulas you're looking for (equations 4-8). I found it by googling "reflection plane normal vector." The vector of the reflected ball doesn't look correct to me.
 
Thanks!
I actually found that page before when searching for this, mabe I am just plain stupid, but I was not sure if it was what I wanted because I found it very confusing.
I will take that page to my math teacher on monday and see if she can explain it to me, but in the mean time (if you have time) would you (please) mind explaining it to me?
 
Whether I can help you understand in this limited space depends on your knowledge of vectors. This graph from that link is the key to the explanation. What questions do you have about it?

Reflection2_751.gif
 
Top