Good afternoon.
I am on a holidays right now, and got a spare week for my own codding fun. Decided to do some 3D programming and i've stumbled upon one problem.
At the moment i am doing a simple task really.
Theres a cube "starting" at X0, Y0, Z0 position and theres "me" at X1, Y1, Z1.
I want to determine if am "targeting" the cube (like Minecraft).
For example:
[WhereIStand]:[-2.1618571][-2.5086415][-2.299999] - My location cordinate
[WhereILook]:[0.7986355][0.60181504][0.52991927] - My view vector (Where i am looking at)
[WhereCubeIs]:[0][0][0] - Cubes location cordinate
[CubeVector]:[1][1][1] - Cubes "Growth" vector
And after this i am stuck.
My problem is that i don't know what to ask of google.
I was thinking about two solutions:
A) Shoot a "missile", it will hit after some time, and i will know if i am "targeting" cube or no. (Kinda retarded idea)
B) 3D Projection into 2D (Get X and Y out of X, Y, Z), no idea how to achieve that. Plus i will dig a grave with it for myself.
This problem is succesfully solved in software like 3D Max or Wings 3D, you can even select a polygon.