Skip to content

How to throw object in the direction of camera? #281

Discussion options

You must be logged in to vote

If I understand correctly, you are looking for the direction of your camera in world-space. Since you view matrix V transforms points from world-space to camera space. Therefore, the inverse view matrix $V^{-1}$ will transform a point from camera-space to world-space. This means that if you want to have the direction $d_w$ of the camera in world-space, you need to multiply the direction $d_c$ of the camera in camera-space (for instance the negative z-axis if the camera is looking in this direction) by the inverse of the view matrix $V^{-1}$ to get the camera direction in world-space.

$$ d_w = V^{-1} d_c $$

Also note that the view matrix $V$ is a rotation matrix and therefore the inverse o…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@patrikpatrik
Comment options

Answer selected by patrikpatrik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants