Add a new configuration warning to CollisionShape

In the case where a ConcavePolygonShape is used as a shape for a RigidBody
in another mode than static, a configuration warning will appear in the
editor.

(cherry picked from commit ad227d9a85)
This commit is contained in:
Pierre Caye 2020-03-03 17:05:10 +01:00 committed by Rémi Verschelde
parent 15057c9284
commit 5062d7499f
2 changed files with 9 additions and 0 deletions

View file

@ -127,6 +127,14 @@ String CollisionShape::get_configuration_warning() const {
return TTR("Plane shapes don't work well and will be removed in future versions. Please don't use them.");
}
if (Object::cast_to<RigidBody>(get_parent())) {
if (Object::cast_to<ConcavePolygonShape>(*shape)) {
if (Object::cast_to<RigidBody>(get_parent())->get_mode() != RigidBody::MODE_STATIC) {
return TTR("ConcavePolygonShape doesn't support RigidBody in another mode than static.");
}
}
}
return String();
}

View file

@ -590,6 +590,7 @@ void RigidBody::set_mode(Mode p_mode) {
PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_KINEMATIC);
} break;
}
update_configuration_warning();
}
RigidBody::Mode RigidBody::get_mode() const {