4
\$\begingroup\$

I am currently building a 3D game presented from a 2D isometric viewpoint.

The 3D coordinates start at the top left corner of the screen with x and y increasing towards the right and bottom edges respectively. An angle about the z axis starts with 0 facing right and increases CW.

The isometric coordinates use the diamond method seen in this reference:

enter image description here

My problem is related to choosing the correct frame for my characters. The characters each have a sprite sheet containing an image for one of the 8 compass directions. The start with the image facing right and rotate CW as in the 3D coordinates.

How can I choose the correct sub-image based on their rotation in 3D space? Is the problem is equivalent to converting the rotation into the isometric coordinate space?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Yes, the problem is the same as converting rotation to the isometric coordinate space. Though, it's somewhat simpler.

The primary "conversion" takes place by deciding how the rotation applies to the compass directions. For example, deciding that north is 0 degrees. Choosing the sprite to use is as simple as breaking a full 360 degrees in the the 8 compass directions.

See my answer here for an easy way to convert angle into compass directions.

\$\endgroup\$
2
  • \$\begingroup\$ This is useful, but it doesn't explain how to perform the angle conversion. \$\endgroup\$
    – Nick
    Commented Mar 20, 2013 at 20:46
  • \$\begingroup\$ @Nick You did see the answer I linked? The conversion is pretty straight forward, what about it do you not understand? \$\endgroup\$
    – House
    Commented Mar 21, 2013 at 4:58

You must log in to answer this question.

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