If I scale a sprite at its centre, then try to rotate it around its centre as well, the rotation does not occur around its centre.

If you need to rotate, for example a scaled ball,the way its working it is set the scale center at the top left (0,0) set the scale that you want, and then set the rotation center to the middle of the scaled sprite, and then apply the rotation modifier.

blaBloBliSprite.setScaleCenter(0, 0);
blaBloBliSprite.setPosition(557, CAMERA_HEIGHT / 2 - blaBloBliSprite.getHeightScaled() / 2);
blaBloBliSprite.setRotationCenter(blaBloBliSprite.getWidthScaled() / 2, blaBloBliSprite.getHeightScaled() / 2);

But I want to scale a sprite at its centre as well.

Is there any way of doing it?

  • 1
    \$\begingroup\$ What technology are you using? How is rotation and scale stored and computed? This question is not very helpful, all I can read is "THIS NO WORK, NEED HELP" It can be done in a million ways... \$\endgroup\$
    – rioki
    Apr 23, 2013 at 14:43
  • \$\begingroup\$ I don't think any new thing you have to do for this. Default rotation center is middle of any sprite. So you don't have to set it manually. If you found any thing wrong again then you have to become more precise about you question so we can understand more better. \$\endgroup\$
    – Siddharth
    Apr 23, 2013 at 17:18

2 Answers 2


You are setting rotation center in the world, not on the sprite. So if you set rotation centre to (0, 0) the sprite will rotate around left corner of the screen. You must set the rotation center similar to this:

float centerX = sprite.getX() + sprite.getWidth() / 2;


There isn't enough information to solve this - we have no idea what any of those functions do. Is this custom software? Is it technology from someone else?

I don't understand why one even needs a "scale center". It all seems like an overly complicated piece of tech for something so simple.

Try setting the rotation centre with the unscaled width/height. It's extremely likely that the technology does the rotation before scaling. As such, you're scaling the centre twice which would offset your centre and cause the bad rotation and possibly positioning.

  • 5
    \$\begingroup\$ OP is using andengine and this isn't really much of an answer. \$\endgroup\$
    – bummzack
    Apr 25, 2013 at 14:30

You must log in to answer this question.

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