0 votes

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

Godot version 3.2.3
in Engine by (12 points)

1 Answer

0 votes

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

by (4,132 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.