0
\$\begingroup\$

My sprite geometry is reversed using matrix so that it is in the XZ plane. This results in the image used for the sprite to also be reversed, which I don't want:

enter image description here

(source : http://www.badlogicgames.com/wordpress/?p=2032 )

The image is then upside-down (note the 2 and 4):

enter image description here

Would you know how to switch the UVs, or apply a matrix on the image only?

Here is my code to draw the new image (the broken one):

curPix.drawPixmap(modelPix, newX, newY, modelX, modelY, tileResolution, tileResolution);

This is how the plane is modified in "render:"

batch.setProjectionMatrix(cam.combined);
batch.setTransformMatrix(matrix);
batch.begin();
getMap(0).draw(batch);
batch.end();
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

It seems as though you're just seeing the back of the quad, which will be the reverse of the front.

To fix this, simply rotate -90 degrees about the z-axis, so the quad is facing up instead of down. You'll have to move it down the x plane a little after that though.

Otherwise you can rotate the quad 90 degrees about the z-axis, and then 180 degrees about the x-axis to get it facing up. You probably shouldn't mess around with the UV coordinates if you're using a spriteBatch interface.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks, I managed to make it work with TextureRegion and its method flip(boolean x, boolean y). Thanks for the answer \$\endgroup\$
    – Paul
    Commented Jan 16, 2014 at 2:23

You must log in to answer this question.

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