Mention that Area2D doesn't support one_way_collision
(cherry picked from commit c836bdf5b1
)
This commit is contained in:
parent
06b7f218c6
commit
bdbbc78da4
@ -19,6 +19,7 @@
|
||||
</member>
|
||||
<member name="one_way_collision" type="bool" setter="set_one_way_collision" getter="is_one_way_collision_enabled" default="false">
|
||||
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.
|
||||
</member>
|
||||
<member name="one_way_collision_margin" type="float" setter="set_one_way_collision_margin" getter="get_one_way_collision_margin" default="1.0">
|
||||
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.
|
||||
|
@ -20,6 +20,7 @@
|
||||
</member>
|
||||
<member name="one_way_collision" type="bool" setter="set_one_way_collision" getter="is_one_way_collision_enabled" default="false">
|
||||
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.
|
||||
</member>
|
||||
<member name="one_way_collision_margin" type="float" setter="set_one_way_collision_margin" getter="get_one_way_collision_margin" default="1.0">
|
||||
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.
|
||||
|
@ -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"
|
||||
|
||||
@ -273,6 +274,9 @@ String CollisionPolygon2D::get_configuration_warning() const {
|
||||
warning += TTR("Invalid polygon. At least 2 points are needed in 'Segments' build mode.");
|
||||
}
|
||||
}
|
||||
if (one_way_collision && Object::cast_to<Area2D>(get_parent())) {
|
||||
warning += TTR("The One Way Collision property will be ignored when the parent is an Area2D.");
|
||||
}
|
||||
|
||||
return warning;
|
||||
}
|
||||
@ -295,6 +299,7 @@ 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 {
|
||||
|
@ -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"
|
||||
@ -204,6 +205,9 @@ String CollisionShape2D::get_configuration_warning() const {
|
||||
warning += TTR("Polygon-based shapes are not meant be used nor edited directly through the CollisionShape2D node. Please use the CollisionPolygon2D node instead.");
|
||||
}
|
||||
}
|
||||
if (one_way_collision && Object::cast_to<Area2D>(get_parent())) {
|
||||
warning += TTR("The One Way Collision property will be ignored when the parent is an Area2D.");
|
||||
}
|
||||
|
||||
return warning;
|
||||
}
|
||||
@ -226,6 +230,7 @@ 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user