Reputation: 111
I have some problem with correct anchor point adjustment. First thing first, I have mainlayer and sublayer, what I want to do is set some point as anchor point of that sublayer then set sublayer position at (0,0). So, in my opinion sub layer should move to (0,0) position in mainlayer.
But my below code is not working as I expected.
[sublayer setAnchorPoint:ccp(x/sublayer.contentSize.width,y/sublayer.contentSize.height)];
[sublayer setPosition:ccp(0,0)];
Upvotes: 0
Views: 126
Reputation: 10860
First of all, CCLayer by default is not relatieve to anchor point, so it will ignore any changes on it. You can enable it by
[layer setIsRelatieveAnchorPoint: YES];
The second - you should not change anchor point if you don't fully understand how it works.
Upvotes: 1