I don't know shite about:
My Godot collision shapes are possessed!
Why do my godot collision shapes resize together?
I wanted to create differently sized collision boxes for different sprite animations in Godot because they vastly differed from each other. For example The dimensions on my horizontal run animation is rectangular, but the Run_Up animation is rather square.
Because my project already contained one CollisionShape2D
Node for my Run_X animation, I went ahead and duplicated this Node to save some time.
The Problem
But boy was I wrong. This did everything except saving time 🤡. When I tried to adjust the CollisionShape2D
's rectangle shape to the desired dimensions the Shapes suddenly started to resize in unison.
As if they are somehow connected. And as I found out, they are in fact connected.
When creating a CollisionShape2D
, Godot tells you to assign a Shape to your Node because without this visual representation it's completely useless.
But all the duplicated CollisionShape2D
that I created where pointing to the same Rectangle shape. Resizing the shape inside the Godot editor was therefore editing this Shape ressource and not the CollisionShape2D
configuration.
Thanks to Godot's human-readable Scenen file (here Squirrel.tscn
) I could actually see what was happening behind the scenes.
All CollisionShape2D
had SubResource( 4 )
assigned as their shape
property. And in the same file I could see that SubResource( 4 )
is one RectangleShape2D
.
Solution
After knowing the issue, the solution is quite straightforward. I simply needed to apply a new RectangleShape2D
for the shape of each CollisionShape2D
Node.
Then I could adjust the shape's dimensions based on the animation sprites dimension.
After doing that, it's also clearly visible in the Scene file (here Squirrel.tscn
) that each CollisionShape2D
has it's own RectangleShape2D
subresource.
I hope this helps someone out there who encounters the same problem 🥳