Fix collision shape update when changing shape properties

This change does two things:

1. Properly update the internal shape data using _update_in_shape_owner
when updating a shape (in 2D it was resetting one way collision)

2. Avoid unnecessary updates when calling set_shape with the same shape,
which happens each time a shape property is modified
(e.g shape.extents.x = ...)

Fixes #45090

(cherry picked from commit 4b43cd17c5)
This commit is contained in:
PouleyKetchoupp 2021-01-11 09:04:08 -07:00 committed by Rémi Verschelde
parent 8f19d50e27
commit a994bb4ad3
No known key found for this signature in database
GPG key ID: C3336907360768E1
3 changed files with 9 additions and 3 deletions

View file

@ -205,6 +205,7 @@ void CollisionPolygon2D::set_polygon(const Vector<Point2> &p_polygon) {
if (parent) {
_build_polygon();
_update_in_shape_owner();
}
update();
update_configuration_warning();
@ -221,6 +222,7 @@ void CollisionPolygon2D::set_build_mode(BuildMode p_mode) {
build_mode = p_mode;
if (parent) {
_build_polygon();
_update_in_shape_owner();
}
}