Search code examples
libgdxshape-rendering

Flipping a shaperenderer object in libGDX


I am flipping one of the object in my libGDX project. At the same time I want to flip its shape rendering circle also. How can I do it? here is my code for shaperenderer:

    shapeRenderer.setProjectionMatrix(camera.projection);
    shapeRenderer.setTransformMatrix(camera.view);
    shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
   if (obsObj.isSpider())
            circle(shapeRenderer, ob.getCollisionCircle());
shapeRenderer.end();

and circle method is:

private void circle(ShapeRenderer renderer, Circle circle) {
    shapeRenderer.circle(circle.x, circle.y, circle.radius, 100);
}

I am flipping sprite object like this..

obsSprite.setFlip(true,false);

Solution

  • Instead of using circle/Rectangle shape rendering,I tried shape rendering with polygons. It worked well for rotation and flipping.