diff options
| author | Juan Linietsky | 2016-05-17 18:27:15 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2016-05-17 18:28:44 -0300 |
| commit | c195c0df6b36debc870216dd42e49fbda70fa861 (patch) | |
| tree | 194a26e39ace86d7a471f3e86159c2aed6be261c /scene/2d/collision_polygon_2d.cpp | |
| parent | 3a26e14a2bab777c9ba6aedceff6e4ef2666faf0 (diff) | |
| download | godot-c195c0df6b36debc870216dd42e49fbda70fa861.tar.gz godot-c195c0df6b36debc870216dd42e49fbda70fa861.tar.zst godot-c195c0df6b36debc870216dd42e49fbda70fa861.zip | |
Diffstat (limited to 'scene/2d/collision_polygon_2d.cpp')
| -rw-r--r-- | scene/2d/collision_polygon_2d.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 2a40a6207..544f0e208 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -297,6 +297,20 @@ Vector2 CollisionPolygon2D::_get_shape_range() const { return Vector2(shape_from,shape_to); } +String CollisionPolygon2D::get_configuration_warning() const { + + if (!get_parent()->cast_to<CollisionObject2D>()) { + return TTR("CollisionPolygon2D only serves to provide a collision shape to a CollisionObject2D derived node. Please only use it as a child of Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."); + } + + if (polygon.empty()) { + return TTR("An empty CollisionPolygon2D has no effect on collision."); + + } + + return String(); +} + void CollisionPolygon2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("_add_to_collision_object"),&CollisionPolygon2D::_add_to_collision_object); |
