0
\$\begingroup\$

I have a 2D unit vector containing a world coordinate (the player's direction), and I want to convert that to screen coordinates (classic isometric tiles).

I'm aware I can achieve this by rotating around the relevant axis but I want to see and understand how to do this using a purely matrix approach? Partly because I'm learning 'modern OpenGL' (v2+) and partly because I will want to use this same technique for other things so need a solid understanding and my math ability is a little lacking.

If needed my screen's coordinate system has it's origin at top left with +x & +y pointing right and down respectively. Also, my vertex positions are converted to the NDC range in my vertex shader if that's relevant.

Language is C++ with no supporting libraries.

\$\endgroup\$
  • \$\begingroup\$ By 'purely matrix' I mean, I think I should be able to do this by: Mat4 p = { /*some magic numbers*/ }; Vector2 v = direction * p;. \$\endgroup\$ – Adam Naylor Jun 11 '17 at 16:13
  • \$\begingroup\$ I'm pretty sure you can just use the standard projection * view * direction method \$\endgroup\$ – Bálint Jun 11 '17 at 16:21
  • \$\begingroup\$ A standard isometric world-to-screen matrix (considering in pixels) would be like [[cos 330, cos 210], [sin 330, sin 210]] \$\endgroup\$ – Luis Masuelli Jun 11 '17 at 16:24
  • 1
    \$\begingroup\$ You might find this answer useful in this direction. \$\endgroup\$ – DMGregory Jun 12 '17 at 12:34
  • \$\begingroup\$ @DMGregory thanks, I've done quite a bit of searching and reading across the stack exchange sites. \$\endgroup\$ – Adam Naylor Jun 12 '17 at 14:25

Your Answer

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

Browse other questions tagged or ask your own question.