Merge pull request #70312 from MarcusElg/rigidbodyworldboundarywarning

Show warning when having a WorldBoundaryShape3D as a child of a RigidBody3D
This commit is contained in:
Rémi Verschelde 2022-12-20 10:32:05 +01:00
commit 5aab37f4b8
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 7 additions and 4 deletions

View File

@ -34,6 +34,7 @@
#include "physics_body_3d.h"
#include "scene/resources/concave_polygon_shape_3d.h"
#include "scene/resources/convex_polygon_shape_3d.h"
#include "scene/resources/world_boundary_shape_3d.h"
void CollisionShape3D::make_convex_from_siblings() {
Node *p = get_parent();
@ -125,10 +126,12 @@ PackedStringArray CollisionShape3D::get_configuration_warnings() const {
warnings.push_back(RTR("A shape must be provided for CollisionShape3D to function. Please create a shape resource for it."));
}
if (shape.is_valid() &&
Object::cast_to<RigidBody3D>(get_parent()) &&
Object::cast_to<ConcavePolygonShape3D>(*shape)) {
warnings.push_back(RTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static."));
if (shape.is_valid() && Object::cast_to<RigidBody3D>(get_parent())) {
if (Object::cast_to<ConcavePolygonShape3D>(*shape)) {
warnings.push_back(RTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static."));
} else if (Object::cast_to<WorldBoundaryShape3D>(*shape)) {
warnings.push_back(RTR("WorldBoundaryShape3D doesn't support RigidBody3D in another mode than static."));
}
}
return warnings;