Access to the active camera's view & projection matrix


I’m trying to make a simple 3rd person character demo. The character will be presented in the same way as in Diablo 3 - the camera is fixed and focused on the main character as he moves and turns around.

Since the character will be shooting guns, I want to draw a crosshair on the HUD to indicate his shooting direction. The thing is that I want the crosshair to be drawn exactly where the character is currently aiming at in the world space, but I want to do that in the HUD ( so I don’t want to use a custom mesh attached to the character or anything like that ).

I know how to access character’s world transform, but in order to transform his aiming coordinates to screen space, I’d need to transform them by a View+Projection matrix of the current camera.

And hence my question - how can I obtain that data.


Never mind - I found it :slight_smile:

The AHUD class contains a member field ViewProjectionMatrix, but there’s an evenr better one - you can also call Canvas->Project method from your custom HUD class’s DrawHUD method to get the job done.

Awesome, thanks for this - helped me out. It’s the worst to see “Nevermind, got it.”