# Is the position of a control relative to its anchor in Godot engine?

I'm trying to place a button on the bottom right corner of the screen, so I tried to put all the Anchor parameters in the inspector to the value "End" but the position still needs to be specified relative to the top-left corner. If I try changing the margins in the inspector it kind of works but then I have to change all four margins taking into account the size.

• The position vector is always related to the top left corner of it's parent node, at least for control nodes as i know. The margins are the way to set the "position" relative to the pivot.. However, are you trying to set position programmatically? If not, simply select your control and then go to Layout > Bottom Right. If you want to change only the anchors after you've found a nice position for you control go to Layout > Anchors Only > Bottom right – LookForAngular Nov 11 '18 at 23:29

Having a Node2D with a Button in it you need this code.

extends Node2D

var v:Vector2 = get_viewport().size
$Button.rect_position = v -$Button.rect_size


This does not look clean as the button is squeezed into the bottom right not looking great. It's better to put it in ie a MarginContainer and then move that bottom right. It's Custom constants margins can be set manually.

extends Node2D