How to properly scale?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PugMasterPug
:warning: Old Version Published before Godot 3 was released.

I am trying to scale a StaticBody2D which contains a Sprite and CollisionShape2D, i want that when I scale it, it should snap to the grid, but insted it streches and moves instead of just streching to fit the grid.

That would require the selection box to fit the contents so that dragging the handles matches the grid, which is only the case with GUI nodes. I think you need to post a request on Github for this to work with Node2D.

Zylann | 2017-12-19 03:46

oops… I said Node2D, I meant StaticBody2D, btw I have just solved it, and I will put the solution in the answers section. (I also changed the question and replaced Node2D with StaticBody2D)

PugMasterPug | 2017-12-19 16:27

:bust_in_silhouette: Reply From: PugMasterPug

When I create the StaticBody2D, i have to shrink it by a factor of 2 in both the x-axis and y-axis (keeping the center at the origin), also I should mention that I have the grid to be half the size of the sprite I want to put (The sprite is 32×32, and the grid is 16×16), then when I create the Sprite, It will be half the size I want it to be, so i strech it by a factor of 2 in both the x-axis and y-axis, then I just add tge collisionShape (which is a RectangleShape2D) and set the size, and now the streching fine.