Skip to main content
remove useless tag
Link
Seth Battin
  • 5.5k
  • 3
  • 29
  • 43
added 93 characters in body
Source Link

So, looked at a couple of questions similar to this, led me straight into dead ends. I have an object drawn out in ShapeRenderer, and I wish to rotate only that one object. I have tried shapeRenderer.rotate(x, y, 1, 1), however all of my ShapeRenderer objects rotate. Anyone know how one would go about rotating a single ShapeRenderer object that is defined by an array of vertices? I've posted how I have drawn my object below.

    //LEFT
    shapex[0] = x - 59/2;
    shapey[0] = y + 53/2;
    
    shapex[1] = x - 18/2;
    shapey[1] = y + 30/2 ;
    
    shapex[2] = x - 6/2;
    shapey[2] = y + 53/2;
    
    shapex[3] = x - 16/2;
    shapey[3] = y -51/2; 


    shapex[4] = x - 21/2;
    shapey[4] = y + 1/2;

EDIT: I have tried to use polygon, however I see no good tutorials showing how to use it.

So, looked at a couple of questions similar to this, led me straight into dead ends. I have an object drawn out in ShapeRenderer, and I wish to rotate only that one object. I have tried shapeRenderer.rotate(x, y, 1, 1), however all of my ShapeRenderer objects rotate. Anyone know how one would go about rotating a single ShapeRenderer object that is defined by an array of vertices? I've posted how I have drawn my object below.

    //LEFT
    shapex[0] = x - 59/2;
    shapey[0] = y + 53/2;
    
    shapex[1] = x - 18/2;
    shapey[1] = y + 30/2 ;
    
    shapex[2] = x - 6/2;
    shapey[2] = y + 53/2;
    
    shapex[3] = x - 16/2;
    shapey[3] = y -51/2;

    shapex[4] = x - 21/2;
    shapey[4] = y + 1/2;

So, looked at a couple of questions similar to this, led me straight into dead ends. I have an object drawn out in ShapeRenderer, and I wish to rotate only that one object. I have tried shapeRenderer.rotate(x, y, 1, 1), however all of my ShapeRenderer objects rotate. Anyone know how one would go about rotating a single ShapeRenderer object that is defined by an array of vertices? I've posted how I have drawn my object below.

    //LEFT
    shapex[0] = x - 59/2;
    shapey[0] = y + 53/2;
    
    shapex[1] = x - 18/2;
    shapey[1] = y + 30/2 ;
    
    shapex[2] = x - 6/2;
    shapey[2] = y + 53/2;
    
    shapex[3] = x - 16/2;
    shapey[3] = y -51/2; 


    shapex[4] = x - 21/2;
    shapey[4] = y + 1/2;

EDIT: I have tried to use polygon, however I see no good tutorials showing how to use it.

Source Link

Libgdx - How to rotate a single ShapeRenderer object

So, looked at a couple of questions similar to this, led me straight into dead ends. I have an object drawn out in ShapeRenderer, and I wish to rotate only that one object. I have tried shapeRenderer.rotate(x, y, 1, 1), however all of my ShapeRenderer objects rotate. Anyone know how one would go about rotating a single ShapeRenderer object that is defined by an array of vertices? I've posted how I have drawn my object below.

    //LEFT
    shapex[0] = x - 59/2;
    shapey[0] = y + 53/2;
    
    shapex[1] = x - 18/2;
    shapey[1] = y + 30/2 ;
    
    shapex[2] = x - 6/2;
    shapey[2] = y + 53/2;
    
    shapex[3] = x - 16/2;
    shapey[3] = y -51/2;

    shapex[4] = x - 21/2;
    shapey[4] = y + 1/2;