1
\$\begingroup\$

How do I draw a point in world coordinate space (where the camera is currently looking at, so that would be view*projection correct?)

I would think I would need to do something like:

PositionInWorld = MousePositionInNDC * view * projection? 
\$\endgroup\$
  • \$\begingroup\$ Your secondary question about vertex buffers is entirely separate and should be asked on its own; note also that we don't consider questions that are just asking for links to resources to be on-topic, as they're lists and broad (you may want to ask that on GDNet, or alternatively ask here about the specific issue you're having. \$\endgroup\$ – Josh Nov 30 '16 at 17:49
1
\$\begingroup\$

If you want exactly in the center of the camera's field of view, then what you can do is to take a 3d vector pointing in the monitor (aka. (0; 0; -1)), create a 3x3 rotation matrix with the same angles your camera has and multiply these together, this results in a 3d vector rotated to match the camera's ditection. To get a point x distance from the camera, you multiply this vector with x and you add it to the camera's position.

If you only have access to 4x4 matrices (for example if you use unity), then do everything as above but with a 4d vector and a 4x4 matrix, and before you add the vector to the camera's position, downgrade it to a 3d vector.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.