Geometry - Determine all points along a ray from starting coordinates and direction I am working on a video game. I need to determine each point along a ray with every x interval with the following information:


*

*X, Y, Z coordinates of the starting point of the ray, and,

*X, Y, Z coordinates representing the angle of the ray (the game is 3D, from what I can tell the game engine uses Euclidian vectors)


Of course rays are infinite in number, so I need something like "get next point." My idea is to have the computer get the first point, check it, and if that is not successful, get the next point and check it and so on until a specific point fits what I need. Of course, there some be some arbitrary upper limit to prevent the program crashing due to continually checking many rays.
In my game (it's a Minecraft clone for learning purpuses for anyone who knows about that) there is a 3d grid, each cell in the game is filled completly with some material, ie grass or air. I need to determine the first non-air block in the direction the player is looking. The player can be looking in any direction and is not bound to the grid in any way other than their location being represented by a floating point x, y, and z coordinate on the grid.
NOTE: My game engine does not have a built-in feature to do this. 

Well if $A = (a_1,a_2,a_3)$ is the start point, and $d =(b_1,b_2,b_3)$ is the direction of the reay, you can parametrize the ray by
$$ p  = a + td = \begin{pmatrix} a_1+td_1 \\ a_2 + td_2 \\ a_3+td_3\end{pmatrix}$$ for $t \in \mathbb R$, or for $t \in [0,1]$ if you want to get a point $p$ that is in between $a$ and $b$.
If your 'minecraft' blocks have a edge length of $e$, you can check whether the point
$$ p = a+t\frac{e}{|d|} d = \begin{pmatrix} a_1+t\frac{e}{|d|}d_1 \\ a_2 + t\frac{e}{|d|}d_2 \\ a_3+t\frac{e}{|d|}d_3\end{pmatrix}$$
 within a block for $t = 0,1,2,3,...$ (until you are within a block)
where $|d| = \sqrt{d_1^2+d_2^2+d_3^2}$ is the length of the vector $d$.
Here I used the idea that if you are outside of block, you can make a step of at least the size $e$ in order not to overshoot the possible first block.
