origin vs position

origin vs position
0.0 0


I have a CCSprite.
To center it to the screen I use the following method:
screenSize = CCDirector::sharedDirector()>getWinSize;
>setPosition(ccp(screenSize.width/2, screenSize.height/2));

It does get centered on the screen, which is proof that the ANCHOR POINT is at the center of the CCSprite.
When I printed out the origin though, e.g.:
CCRect rect = this->boundingBox();

print to console rect.origin.x and rect.origin.y
(I wanna show you the CCLOG code but this forum is not showing it properly….)

I was surprised to see that it printed out the coordinates of the lower left corner of the CCSprite.

So origin is always the coordinates of the lower left of any entity within cocos2dx???

Thank you



That’s the bounding box origin, which is always in the lower left.

the CC coordinate system is 0,0 in the lower left, in MaxX,MaxY at the upper right.

Anchor point is not the origin. It’s the anchor with which rotations are referenced as well as translations and other affine transforms.



ok…I get it…than you very much :slight_smile: