Why is there no way to move the center of gravity to the geometric center of a CollisionShape by code?

Godot Version

4.5.1

Question

I want to be able to scale my procedural collision shapes by code, but if I can’t change the origin by code, the scaling makes it move away from the sprite.

I’ve looked through the documentation but I couldn’t find the way to do it. The origin point is not the transform.origin property as far as I can tell.

You can check the source code to see how the editor does it:

and

1 Like

Ah, yes, I was writing a proposal to expose the function in the scripting API when I saw some issues that linked to the abstract_polygon_2d_editor.cpp. Otherwise I wouldn’t have found it by myself. I implemented my own version in Gdscript but it’s not perfect.

Meanwhile, I made the proposal anyway: https://github.com/issues/created?issue=godotengine|godot-proposals|13761