0 votes

Hi there,

I am trying out a video tutorial and I am stuck at a very early stage, unfortunately unable to find a solution, hence I am asking here.

In the tutorial he has his Wall6 node, consisting of a Sprite and a CollisionShape2D, selected. He resizes his wall via the outer grid of his wall node like shown here:
resizing wall node

Yet when I select my node, I do not get the outer grid to resize it
no resize grid

I can select my Sprite and resize it
resize Sprite

as well as resizing the CollisionShape2D, however it is always mirrored on the x and y axis!
resize CollisionShape2d, but always mirrored

To me it seems like he is basically resizing his Sprite and the CollisionShape2D is simply attached to the Sprite, but yeah, I just don't know what I am missing or doing wrong.

Any help would be greatly appreciated :)

p.s.: I am an absolute beginner, not just with Godot, but with creating a game and using a game engine in general. If this question has been asked before I am sorry, but since I have no knowledge, I might have not used the right keywords while searching for an answer.

asked Apr 10, 2019 in Engine by Flawesome (15 points)

1 Answer

+2 votes
Best answer

Scaling physics bodies can lead to all sorts of collision problems, so it has always been discouraged. You're watching a video that was made with an earlier version of Godot, where all Node2D nodes showed stretch handles, even when it was not a good idea to use them. In Godot 3.1, the stretch handles were removed from physics bodies to prevent this.

While in the case of rectangular shapes, this issue is minimal (it's curves and polygons that have the worst issues), the correct way to handle this is to resize the sprite and the extents of the collision shape to match. You can also turn on grid snapping, which makes this even easier.

The reason your collision shape is "mirrored" is that a rectangle shape's size is measured by its "extents" which is the distance from the center (sort of like radius for a circle).

answered Apr 10, 2019 by kidscancode (17,132 points)
selected Apr 10, 2019 by Flawesome

First of all thank you very much for your quick response!

Ok, I didn't know that I shouldn't be doing this anyway. In this example it seemed easier, so I thought that this was the intended way to do it.
So I should just grab the Sprite and the CollisionShape2D and resize them individually!?

"Snap to grid" was already enabled, because it was done so in the tutorial. But I have been playing around the last few minutes trying to get a StaticBody2D consisting of a Sprite and CollisionShape2D to be 32x32 size.
Is changing the Extend x and Extend y values in the CollisionShape2D node the correct way of doing it?

Well, yes if you have snap set to 16x16 you could drag it, or you can just type the values into the extents of the shape.

Thanks a lot!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.