Merge pull request #36772 from pyacier/warning-concavepolygonshape

Add a new configuration warning to CollisionShape
This commit is contained in:
Rémi Verschelde 2020-03-05 12:01:59 +01:00 committed by GitHub
commit ee0f670807
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -123,6 +123,14 @@ String CollisionShape::get_configuration_warning() const {
return TTR("A shape must be provided for CollisionShape to function. Please create a shape resource for it.");
}
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

@ -518,6 +518,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 {