I'm working on a game in Away3d. I'm using an orthographic camera and I'm attempting to simulate an isometric view (the camera has a 37° angle and the y-axis is up/down, x-axis is left/right, and z-axis is orthographic).

I hit a snag in understanding how to handle the z-axis of the NPC's relative to the player so that, for example, when the player is below an NPC in Y coordinates, it doesn't appear to be "under" the NPC, but "besides/in front" the NPC, as currently all the 3D models in this scene are Z-axis coordinate 0.

My common sense says that there should be a relation in the sense that if the Y axis coordinates of the NPC is lower than the Y axis coordinates of the player, then the z-axis coordinates should update following an allegory is so that the apparent view of the NPC relative to the player is that the NPC is "behind" the player. But as I said, because all the z-axis are zero for all the models, the players' apparent position is "under" the NPC, as opposed to "in front" of the NPC.

  • \$\begingroup\$ has been asked several times in some variations: probably one of these: gamedev.stackexchange.com/questions/8151/… gamedev.stackexchange.com/questions/25982/… gamedev.stackexchange.com/questions/49226/… etc. You need some data about the depth of your objects and then should draw them using the painters algorithm. \$\endgroup\$ – Benedikt S. Vogler Nov 13 '14 at 21:41
  • \$\begingroup\$ I think I figured it out, so I mention it here for future reference, if anyone needs it. In my case I needed to project 1 Pixel in 2-D y-axis( up-and-down in my case), with its equivalent in 3-D y-axis and z-axis( To simulate depth).. So basically 1 pixel in 2-D projection is 3-D one pixel in y-axis multiplied with sine of camera angle, and 3-D one pixel in z-axis multiplied with cosine of camera angle. something like this: 3-D position is equal with vector 3-D(x,y * sin( angle),y * cos( angle)) \$\endgroup\$ – user2693072 Nov 14 '14 at 20:49

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.