Merge pull request #48974 from trollodel/debug_shapes_update_crash_3.x

Fix crash on debug shapes update if CollisionObject is not in tree
This commit is contained in:
Rémi Verschelde 2021-05-22 18:29:31 +02:00 committed by GitHub
commit 1d06a7edac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -212,6 +212,11 @@ void CollisionObject::_shape_changed(const Ref<Shape> &p_shape) {
}
void CollisionObject::_update_debug_shapes() {
if (!is_inside_tree()) {
debug_shapes_to_update.clear();
return;
}
for (Set<uint32_t>::Element *shapedata_idx = debug_shapes_to_update.front(); shapedata_idx; shapedata_idx = shapedata_idx->next()) {
if (shapes.has(shapedata_idx->get())) {
ShapeData &shapedata = shapes[shapedata_idx->get()];

View file

@ -66,6 +66,7 @@ void ConcavePolygonShape::_update_shape() {
void ConcavePolygonShape::set_faces(const PoolVector<Vector3> &p_faces) {
PhysicsServer::get_singleton()->shape_set_data(get_shape(), p_faces);
_update_shape();
notify_change_to_owners();
}