Ray tracer and collision detection
Ray tracing and collision detection are...well, kinda messy. I've read some of the tutorials online and always asked myself: where and when the heck ray tracing is going to start? and how do they know which direction it will go. After a little digging and sticking my brain into the computer's monitor, i've finally understand something.
This is basically what i understand. If it is not a good way to do it, please give advice.
So the ray will have a start point and end point. The start point will be the position of the tangible object, and the end point will be where it goes to. To determine the direction of the ray, the object's velocity will be add to the object's position:
With this kind of calculation, every step (or frame) the object moves, it will calculates if the end point will hit anything when the velocity added to the object's position. (i don't know if this is a good idea to do it, but it is pretty simple).
Vector3d startPoint, endPoint, velocity(1, 1, 1);
endPoint = startPoint + velocity;
Well, ray tracing will be useful for collision detection in 3d space. My problem is (i forgot some of the stuff from geometry) determine the plane in 3d space. I've been looking all over the place and found out: the plane's equation is
It looks simple but what the heck is it mean. I know the x, y, z stands for the coordinate but what is 'D' stand for? Can anyone please tell me how does the plane works in 3d space? Thanks
Ax + By + Cz + D = 0