d3d_set_projection(xfrom, yfrom, zfrom, xto, yto, zto, xup, yup, zup)
Argument | Description |
---|---|
xfrom | The x coordinate of the position to look from. |
yfrom | The y coordinate of the position to look from. |
zfrom | The z coordinate of the position to look from. |
xto | The x coordinate of the position to look to. |
yto | The x coordinate of the position to look to. |
zto | The x coordinate of the position to look to. |
xup | The x coordinate of the "up" vector. |
yup | The y coordinate of the "up" vector. |
zup | The z coordinate of the "up" vector. |
Returns: N/A
Although this function is called d3d_set_projection it is really used to modify the view matrix, not the projection matrix. As such, you should first initialize the
projection matrix using the other projection function d3d_set_projection_ext, then use this function to move the view (camera) around within the
projection.
To set the view you first need to define the position you look from, which is indicated by the parameters (xfrom, yfrom, zfrom). Next you must specify the direction you look in and this is done by giving a second
point to look towards with the arguments (xto, yto, zto). Finally, you can still rotate the camera around the line from the viewpoint to the looking point, and to specify this we must give an "up" vector, that is,
the direction that is upwards in the camera. This is given by the last three arguments (xup, yup, zup).
d3d_set_projection(100, 100, 10, 200, 100, 10, 0, 0, 1);
The above code creates a typical first person shooter view.