I've started working on a demo for my 2.5D game. For a basic scene I figured I would just use the good old fashioned doom sprites textured to a double sided plane. Simple enough. But I've been scratching my head as to how to display the proper sprite animation relative to the player viewing the sprite...if that makes since.

For example suppose I have three players in the scene Players A, B, and C as such:

Example layout

Player C should see player A as: Here's an example of what I think player A should look like from C's perspective:

A from C's perspective

While player B would see player A as follows:

A from B's perspective

My current idea is that for any given player, I will need to know the current direction of each other player, and where they are located/moving to relativly. From this, I could calculate which sprite image is required.

Is this correct? What improvements/optimizations could be made?

** EDIT ** Total number of directions will be 8 as depicted below:

enter image description here

For each direction there are two sprites (to show walking movement, sprites for the right hand directions are mirrors of the left):

enter image description here

** EDIT 2 ** Got this working and have a simple javascript/threejs example for anyone interested: https://github.com/commanderZiltoid/threejs-2.5d-fps

  • \$\begingroup\$ How many sprites do you have for the player? Knowing the amount of directions could be helpful for an answer. \$\endgroup\$
    – user35344
    Jan 21, 2016 at 14:46
  • \$\begingroup\$ Question updated \$\endgroup\$
    – whitwhoa
    Jan 21, 2016 at 15:18

1 Answer 1


You would need to know the angle to the element from the spectator, so, if you have

A    |
| \aº|
|bº\ |
|   \|
|    B

where the lines marked with pipes "|" are the "facing" directions, the diagonal is the "attack line", aº is the angle between B sight and A (-30deg) and bº is the angle between A sight and B (-30deg).

You had to add the angles to see the angle of vision (-60deg). that's the rotation of the element, you only have to set the sprite tile that's closer to that rotation angle.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .