Need help understanding convertToWorldSpaceAR and convertToNodeSpaceAR

I am having difficulty understanding convertToWorldSpaceAR and convertToNodeSpaceAR methods. I understand the convertToNodeSpace and convertToWorldSpace but I cant understand these two. Can any one please explain the above two with a simple example.

Those methods refer to Anchor Related point for Nodes.

If you have a Node with Anchor Point Vec2(1,1) that is different from normal behaviour and you need to convert coordinates to or from this node you can use the functions with AR that calculate this difference, otherwise you have to remember that you change anchor point to that node.

Thanks for replying , could you give me an example of how to use convertToNodeSpaceAR

You could easily try this:

Sprite *sprite1 = Sprite::create("CloseNormal.png");
sprite1->setPosition(Vec2(20,40));
sprite1->setAnchorPoint(Vec2(0,0));
this->addChild(sprite1);

Sprite *sprite2 = Sprite::create("CloseNormal.png");
sprite2->setPosition(Vec2(-5,-20));
sprite2->setAnchorPoint(Vec2(1,1));
this->addChild(sprite2);

Vec2 point1 = sprite1->convertToNodeSpace(sprite2->getPosition());
Vec2 point2 = sprite1->convertToWorldSpace(sprite2->getPosition());
Vec2 point3 = sprite1->convertToNodeSpaceAR(sprite2->getPosition());
Vec2 point4 = sprite1->convertToWorldSpaceAR(sprite2->getPosition());

CCLOG("position = (%f,%f)",point1.x,point1.y);
CCLOG("position = (%f,%f)",point2.x,point2.y);
CCLOG("position = (%f,%f)",point3.x,point3.y);
CCLOG("position = (%f,%f)",point4.x,point4.y);

When you run it you will see in log the different positions because sprite’s anchor point are differents than default