Sprite "flip" issue

Hi Everyone,

I am attempting to flip a sprite on a key press. After some googling many people suggested to use setLocalScale (-1f,1f,0) this would effectively mirror the sprite. However for me on JDK 3.2.1 this does not work. My sprite just disappears. If I use setLocalScale(-1f,-1f,0) the sprite appears upside down and facing the correct direction.

Below is a quick code example of my issue. a sprite named “Player” will need to be in the textures folder. If anyone has suggestions on how to mirror/flip the sprite on key press i am open to ideas/what i am doing wrong :smiley:

Thanks for looking

    Spatial player;
    public static void main(String[] args) {
        Main app = new Main();

    public void simpleInitApp()
        //setup camera for 2D games
        cam.setLocation(new Vector3f(0,0,0.5f));
        player = getSpatial("Player");
        player.move(settings.getWidth()/2, settings.getHeight()/2,0);
        //The Below Works 
        //The Below Does Not Work

    public void simpleUpdate(float tpf) {
        //TODO: add update code

    public void simpleRender(RenderManager rm) {
        //TODO: add render code
    private Spatial getSpatial(String name)
        Node node = new Node(name);
        //Load the sprites
        Picture pic = new Picture(name);
        Texture2D tex = (Texture2D) assetManager.loadTexture("Textures/"+name+".png");
        pic.setTexture(assetManager, tex, true);
        //adjust picture
        float width = tex.getImage().getWidth();
        float height = tex.getImage().getHeight();
        pic.move(-width/2f, -height/2f,0);
        //add a material to the picture
        Material picMat = new Material(assetManager, "Common/MatDefs/Gui/Gui.j3md");
        //set the radius of the spatial
        //(using width only as a simple approximation)
        node.setUserData("radius", width/2);
        //attach the picture to the node and return it

        return node;

When you flip the triangles, their windig order is reversed and they will be culled
(you will be looking at them from behind).

Try adding


to disable culling.

Turning off culling of both faces and then only culling the back face yield the same results. The sprite still disappears.

Ill keep looking at this I must be missing something.

What does this mean? You should only turn off culling. Don’t set something else. Culling the back face is the default… you don’t want that. You want no culling. Not any. None.

In the final result, you want culling off… ie: both faces always rendered. Let the GPU take care of what to render.