It's possible to Custom 2d transform pivot in Godot ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ghostfun

I want make a 2d rotlling cube, the axis need always to be right corner, i try to use postion2d as the parent node, but it only can rotate once.

Anyone can help me please!

enter image description here

:bust_in_silhouette: Reply From: Wakatta

Not that you can’t get it done with a Position2d but what you want might be easier achieved using any node that derives from the Control node as they have the rect_pivot_offset property

So in practice lets say you use a TextureRect

texture_rect.set_rotation_degrees(45)
var position = Vector2(0, texture_rect.get_size().x)
texture_rect.set_rect_pivot_offset(position)

know that position will change with each rotation