diff --git a/doc/classes/CollisionPolygon2D.xml b/doc/classes/CollisionPolygon2D.xml
index d119c9579..6612cf174 100644
--- a/doc/classes/CollisionPolygon2D.xml
+++ b/doc/classes/CollisionPolygon2D.xml
@@ -19,6 +19,7 @@
If [code]true[/code], only edges that face up, relative to [CollisionPolygon2D]'s rotation, will collide with other objects.
+ [b]Note:[/b] This property has no effect if this [CollisionPolygon2D] is a child of an [Area2D] node.
The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the polygon at a high velocity.
diff --git a/doc/classes/CollisionShape2D.xml b/doc/classes/CollisionShape2D.xml
index 2d03328ba..5ef8d3fc9 100644
--- a/doc/classes/CollisionShape2D.xml
+++ b/doc/classes/CollisionShape2D.xml
@@ -20,6 +20,7 @@
Sets whether this collision shape should only detect collision on one side (top or bottom).
+ [b]Note:[/b] This property has no effect if this [CollisionShape2D] is a child of an [Area2D] node.
The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the shape at a high velocity.
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 439dbc4c2..805f48005 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -32,6 +32,7 @@
#include "collision_object_2d.h"
#include "core/engine.h"
+#include "scene/2d/area_2d.h"
#include "scene/resources/concave_polygon_shape_2d.h"
#include "scene/resources/convex_polygon_shape_2d.h"
#include "scene/resources/shape_2d.h"
@@ -275,6 +276,10 @@ String CollisionPolygon2D::get_configuration_warning() const {
}
}
+ if (one_way_collision && Object::cast_to(get_parent())) {
+ warning += TTR("The One Way Collision property will be ignored when the parent is an Area2D.");
+ }
+
return warning;
}
@@ -296,6 +301,8 @@ void CollisionPolygon2D::set_one_way_collision(bool p_enable) {
if (parent) {
parent->shape_owner_set_one_way_collision(owner_id, p_enable);
}
+
+ update_configuration_warning();
}
bool CollisionPolygon2D::is_one_way_collision_enabled() const {
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index 5830af648..bfa56bef3 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -32,6 +32,7 @@
#include "collision_object_2d.h"
#include "core/engine.h"
+#include "scene/2d/area_2d.h"
#include "scene/resources/capsule_shape_2d.h"
#include "scene/resources/circle_shape_2d.h"
#include "scene/resources/concave_polygon_shape_2d.h"
@@ -206,6 +207,10 @@ String CollisionShape2D::get_configuration_warning() const {
}
}
+ if (one_way_collision && Object::cast_to(get_parent())) {
+ warning += TTR("The One Way Collision property will be ignored when the parent is an Area2D.");
+ }
+
return warning;
}
@@ -227,6 +232,8 @@ void CollisionShape2D::set_one_way_collision(bool p_enable) {
if (parent) {
parent->shape_owner_set_one_way_collision(owner_id, p_enable);
}
+
+ update_configuration_warning();
}
bool CollisionShape2D::is_one_way_collision_enabled() const {