How to scale a RigidBody2D?

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

If you scale a RigidBody2D, it’ll automatically scale it back the next frame. How can I prevent this?

:bust_in_silhouette: Reply From: mateusak

Just found this. Well, it seems the only solution then is to create a subnode in the RigidBody2D and store everything in it, and scale this node instead.

I don’t think this works anymore in Godot 3.x because a RigidBody2D needs to have a direct children of type CollisionShape2D.

bluenote | 2019-12-17 10:24

:bust_in_silhouette: Reply From: sergey

another way is to re-scale and re-position all children

e.g.

I also don’t think this is allowed in Godot 3.x because the documentation says that applying a scale to the CollisionShape2D child is illegal and leads to unexpected behavior. And scaling only the visible children, but not the shape obviously also doesn’t lead to the desired behavior.

bluenote | 2019-12-17 10:28