How to set nodes position as if it is child of the canvas

so i have Canvas node under that game node under that player node when i set players position it is set relative to its parent. so if i do (0,0) but if there is another node under canvas node at the same leves as game node and i do (0,0) it is sets at the center.

so i want to set players position as (0,0) and have it at the center of screen not left bottom. i know this is not the best explanation but i thought i understood this coordinate thing but it’s getting very weird

Canvas
----Game
-------Player
----another

i know how to use convertToNodeSpaceAR or these convert stuff but i dont know how can i set the position of the node like that

if parent’s anchor is (0,0),you can set the Player’s position to (parent.node.width / 2, parent.node.height / 2)

or you can set the parent’s anchor to (0.5,0.5),and set the Player’s position to (0,0)

or you can use:

        var centerPos = cc.v2(canvas.width / 2, canvas.height / 2);
        Player.node.position = Player.node.parent.convertToNodeSpaceAR(centerPos);
1 Like