Sparky
Sparky copied to clipboard
Order of Transformation stack
I was using the engine to make a demo when I came accross a problem. I had a map object that contained tile objects that each could contain a single entity. I then used the transformation stack in map to position the tiles and in tiles to position the entity.
However when I wanted to rotate the entity on the spot I was unable to since it rotated around the origin point, aka the point the sprite would be in before the translation of the map and the tile.
A fix for this is changing
m_TransformationStack.push_back(m_TransformationStack.back() * matrix);
to
m_TransformationStack.push_back(matrix * m_TransformationStack.back());
in renderer2d.h