How to enable interactive edition for exported Shape2D ?

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

If I use some CollisionShape2D, I can add some shape, and then I have access to a very nice interactive way to edit the shape. For exemple for a RectangleShape2D it looks like :

However it does not work, if I export such shape in my own script :

var export(Shape2D) my_shape

I can create a new shape in the editor, but not interactively edit it. So, how can I enable this feature for my shapes ?

:bust_in_silhouette: Reply From: eons

The “interactive” thing is made by the CollisionShape/2D editor helper, you can make your own with the tool mode (you will have to “create” the tool, draw the points, control the drag, et cetera).

But I don’t understand the point of that exported shape, the CollisionShape/2D nodes already do that and is the only function they have (apart from the visible debug information).

I wanted to use the shape to determine an area where some stuff can pop. I can (and I will) use CollisionShape2D, but since the collision part of it was not needed, I tried to do my own node. Then I just became curious to know whether I missed something simple or if it was just not the right think to do.

Kolaru | 2017-02-16 13:16

Is not “wrong”, but will be redundant, for overlap detection without collision you have the Area2D nodes which can be used with CollisionShape2D or use physics bodies and toggle the “trigger” property of the shape.

Shapes can be used alone too, like in the “shower of bullets” demo but as you saw, you will miss the editor helper visual tools (you can make them yourself, of course).

eons | 2017-02-16 14:24