I'm creating a game for my games class assignment, and in the advanced section we're tasked with implementing mouse picking, meaning clicking on a game object to select it, which is essentially worldpoint to pixel which is straightforward enough, however to click somewhere and have an object move there is pixel to worldpoint which is more challenging.
Essentially after performing the calculations as instructed in the lecture notes, I end up with a 3D point on the camera's near clip plane, and by normalizing the subtraction of the camera position from that 3D point I get its direction, however there are no detailed further instructions on how to proceed from there.
What I want is the 3D point on the "ground" which is at $y = 0$, so the way I think about it is, I should move that point from its starting position along its direction until its $y$ position becomes $0$, and then I have the point my object should go to, however I'm unsure of how to do this. Any help would be appreciated, thank you.
EDIT: Alright, so I have a CVector3 startingPos = [x, y, z], and a CVector3 direction = [x, y, z] which is constructed from normalise(startingPos - cameraPos), and I want to find out the calculations I have to perform in order to plot that point's movement along that calculated direction until the $y$ component of startingPos becomes $0$ so I get the point on the "ground" I want.