+1 vote

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 :

Shape editor

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 ?

in Engine by (20 points)

1 Answer

+1 vote
Best answer

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).

by (7,894 points)
selected by

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.

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).

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.