How do I set the pivot point of a Button in 2.1?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By user41420082
:warning: Old Version Published before Godot 3 was released.

So this sounds stupid but I can’t figure out how to move the pivot point for Buttons. For example, I have a button and wanted to rotate it from the center. It rotates to the top-left as its pivot point. The tooltip on the Select Mode says I should press V to change pivot but I’m not seeing any visual feedback at all when I press it nor does the pivot point change.

:bust_in_silhouette: Reply From: avencherus

You need to make sure your node is selected and the cursor is located where you want the pivot point to go, then press V. The shortcuts generally only work when you’re hovering the panel they are assigned to.

That did work for Sprites but on Buttons it doesn’t work. I can’t even see the offset property on the button’s property inspector

user41420082 | 2016-10-12 23:22

Oh my mistake, I thought Node2D is where the offset property came from. Apparently they’re only on specific nodes like Sprites.

As vinod says below, use a work around.

Us an empty parent node as a pivot point.

What I would do is use a Position2D node as a parent, since it has a visible cross hair. Put the button as a child of it, set the property “Behind Parent” to true so you can see it, or change it’s Z order. Then move your button while knowing that Position2D cross hair is your pivot. After that, go back and do your rotations on the Position2D.

avencherus | 2016-10-13 07:25

Thanks! This sounds like a good idea

user41420082 | 2016-10-13 23:20

You’re welcome. X)

avencherus | 2016-10-13 23:24

helpful thanks! position2d works

lovegd | 2018-01-05 09:19

:bust_in_silhouette: Reply From: vinod

There are no pivot points for Canvas objects.

A simple workaround is to add a Container with width and height set to 0. Then add your button as a child of this Container by positioning it to the button’s -halfwidth and -halfheight.

Thanks! I did not know buttons didn’t have them

user41420082 | 2016-10-13 23:19