All body pivot points on top left corner.

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

Lets say for example i need to rotate a platform (StaticBody2D) from its center, is there no way to do this in the editor? The pivot points of all my bodys are on 0,0 how do i move them , if i can even do that.

‘V’ doesn’t work on bodys as i have read.

thank you very much!

Oh, and as a comment following my answer to your question, Control and UI (user interface) nodes do not seem to have the “Center” function. So nodes like text labels, buttons, menus, et cetera, won’t be able to have their pivot point offset or centered at all.

TheJokingJack | 2021-01-07 01:54

:bust_in_silhouette: Reply From: TheJokingJack

So I take it that you want to want something like this: https://drive.google.com/file/d/1guT4kFGO99DTsvLd1dQSWoORkff593ZB/view?usp=sharing
Where if you rotate it: https://drive.google.com/file/d/1OuNFDkkV1O8Mz4JIz2ACricljkDn6BL6/view?usp=sharing
It will rotate it around it’s center.

Well, all you have to do, is to check that “Centered” option in the sprite.
https://drive.google.com/file/d/1konLgg7dWyYjUhrI5zfc6FrML8mT3H5A/view?usp=sharing

There is no option like that in StaticBody2D though. It’s because StaticBody2D, the way I like to think about it, is basically a position (albeit with other properties).

I imagine your scene might be a bit like this: StaticBody Offset.png - Google Drive
Where the sprite is offset from the StaticBody2D’s Position.

So if you rotate it, it will rotate from the top-left corner (because the axis is the StaticBody’s position).

What you want to do is to make sure that both your sprite and collisionshape are perfectly centered on top of your StaticBody2D.

A way you can get a child node (e.g. the chicken sprite and the collisionshape) to be perfectly centered on its parent node is to put it’s position to 0, 0. Because it inherits its parent node’s position (e.g. the StaticBody2D), 0, 0 for the child node (Chicken Sprite) is exactly where the parent node (StaticBody2D) is, no matter where it is or what position the StaticBody2D is in.

View this short video showcasing the above paragraph: Godot Engine - test.mp4 - Google Drive

(Sorry for the extremely long answer)

Sorry?! About what? Your response was incredible!! Thank you very much, clear and well explained! You are amazing! Even provided pictures AND a video!

Lampros | 2021-01-06 23:13

Thanks a lot!

TheJokingJack | 2021-01-07 01:03