summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-03-05 12:01:59 +0100
committerGitHub <noreply@github.com>2020-03-05 12:01:59 +0100
commitee0f670807e279be07938cc06b48847456c98e8e (patch)
treefae7d6f5d388694d71b4f58d89cea15731f2204c
parente8b68c48eaba0874274c507872336e29895658a5 (diff)
parentad227d9a85ad1164ba7e1b099b332bef99f1883b (diff)
Merge pull request #36772 from pyacier/warning-concavepolygonshape
Add a new configuration warning to CollisionShape
-rw-r--r--scene/3d/collision_shape.cpp8
-rw-r--r--scene/3d/physics_body.cpp1
2 files changed, 9 insertions, 0 deletions
diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp
index 35e4a61cd6..d825c8daf7 100644
--- a/scene/3d/collision_shape.cpp
+++ b/scene/3d/collision_shape.cpp
@@ -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();
}
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index eba45a5604..2f8dc31cb6 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -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 {