0
\$\begingroup\$

As the title suggests, I am wondering if it's possible to emulate a 3d arrow trajectory to a top-down 2d game? If you would look at this clip of Age of Empires 2 game, especially when archers are firing from bottom to top. Can the parabola/arc of the trajectory (in that certain view angle) be emulated in a 2d orthographic, top-down game? So that the arrows would look like they're in 3d space. I know it's tricky but I wonder if there's some computation available for this.

enter image description here

If you could point me in the right direction or some sample code I would be very grateful. I've only implemented this projectile motion in a side-scroll view.

Thank you in advance.

\$\endgroup\$
  • \$\begingroup\$ There's a similar question answered on StackOverflow that may be of use to you here. The main insight is that projectile movement doesn't care about your rendering perspective. Looking at your scene top-down, side-on, full 3D perspective, etc. does not change the laws of physics or alter how projectiles move. All it changes is the rendering logic for where you draw the image on the screen. A projection matrix can handle this transformation from logical world simulation space to rendered screen space. \$\endgroup\$ – DMGregory Nov 28 at 16:43
  • \$\begingroup\$ Thank you very much for the insight, I'll check that link and study the answer there. \$\endgroup\$ – user1865775 Nov 29 at 7:58
1
\$\begingroup\$

Store the Z coordinate and move object as if it was in 3D space. When drawing on screen, add object's Z to Y (you can multiply Z by some constant to make world look 'flatter').

\$\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.