I noticed this on Cocos2d-html5 and posted there but no one responded. So I decided to try it out on Cocos2d-x and there problem exists here too :P.
Basically if I rotate a layer that contains a sprite and then try to convert that sprite’s position to the world coordinates, I get values that are WAAAAY off.
// This is a layer that has just been created, no other transformations have been done to it.
CCSprite* sp = CCSprite::create();
// Place sprite in middle of the screen.
sp->setPosition(ccp(300, 400));
addChild(sp);
setRotation(-90);
CCPoint p = convertToWorldSpace(sp->getPosition()); // I get (380, -1.3e-05)!!!
That is certainly not what I would expect, I would expect to remain at (300, 400). I’m not if I’m misunderstanding something here or it’s an issue in the framework.
Thoughts?
C.J.