Topic was automatically imported from the old Question2Answer platform.
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.
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.