How the parent's rotation impacts the children's rotation and position?

How the parent's rotation impacts the children's rotation and position?
0.0 0


Hi guys,
If i add a child to a parent(Sprite), set it’s position at (0, 100). Then i rotate the parent by 90 degree. The child did rotate also 90 degree, but it’s position is still at (0, 100), in my thought as a Flash developer ever, the child not only should rotate 90 degree, but also should move to (100, 0) position. It means rotation does not rotate the coordinate space?
Thanks, maybe this is a basic of the cocos2d-x, but i don’t know yet!


Hi longyangxi,

it might be the unset anchor point, not sure yet.
Maybe the CCSprite and its Nodes (if added as such) need to have a common anchor point
followed then by your rotation logic:

CCSprite* container1 = CCSprite::create("container.png");
container1->setAnchorPoint(ccp(0, 0));// Anchor Point

CCSprite* child1 = CCSprite::create("birdy.png");
child1->setAnchorPoint(ccp(0, 0));// Anchor Point


Let me know what happens when the anchor point is set.

Hope it helps. :wink:


hey just wanted to give some inputs, intention is not to refute yours ok, so cheers.:slight_smile:
and pls. correct me if im wrong.
I believe that the child sprite’s position is relative to its parent’s coordinate space. so when you move the parent it’s child moves along and maintain its position base not on the world-space but the parent’s space.


@Eschmelax & @newstar55a
Thanks for your warmhearted, i made a mistake for that. I set the rotation before i added the child, so it seemed a issue, anyway, thanks!