summaryrefslogtreecommitdiff
path: root/scene/2d/collision_object_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/collision_object_2d.cpp')
-rw-r--r--scene/2d/collision_object_2d.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index b4f9f3fd9d..d05c818ae1 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "collision_object_2d.h"
#include "scene/scene_string_names.h"
#include "servers/physics_2d_server.h"
@@ -327,6 +328,20 @@ void CollisionObject2D::_update_pickable() {
Physics2DServer::get_singleton()->body_set_pickable(rid, pickable);
}
+String CollisionObject2D::get_configuration_warning() const {
+
+ String warning = Node2D::get_configuration_warning();
+
+ if (shapes.empty()) {
+ if (warning == String()) {
+ warning += "\n";
+ }
+ warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape2D or CollisionPolygon2D as a child to define its shape.");
+ }
+
+ return warning;
+}
+
void CollisionObject2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_rid"), &CollisionObject2D::get_rid);