diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-04 16:40:10 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-04 16:40:10 +0100 |
commit | f4059d0e3c0a2397d779257a441994e2bed71b52 (patch) | |
tree | 703c0922135eea9d59729a62e25e853ca93a6582 | |
parent | 8a716e3275a9abf9380a0c4330aff1871b3e3215 (diff) | |
parent | 6838fe3f44432f0516e8f861104a8ddee57329b0 (diff) | |
download | redot-engine-f4059d0e3c0a2397d779257a441994e2bed71b52.tar.gz |
Merge pull request #86576 from bikemurt/no-concave-warnings
Add warning for using concave shape on CharacterBody3D
-rw-r--r-- | scene/3d/collision_shape_3d.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp index 0bb0382301..61941a0e53 100644 --- a/scene/3d/collision_shape_3d.cpp +++ b/scene/3d/collision_shape_3d.cpp @@ -35,6 +35,7 @@ #include "scene/resources/concave_polygon_shape_3d.h" #include "scene/resources/convex_polygon_shape_3d.h" #include "scene/resources/world_boundary_shape_3d.h" +#include "vehicle_body_3d.h" void CollisionShape3D::make_convex_from_siblings() { Node *p = get_parent(); @@ -130,13 +131,24 @@ PackedStringArray CollisionShape3D::get_configuration_warnings() const { } if (shape.is_valid() && Object::cast_to<RigidBody3D>(col_object)) { + String body_type = "RigidBody3D"; + if (Object::cast_to<VehicleBody3D>(col_object)) { + body_type = "VehicleBody3D"; + } + if (Object::cast_to<ConcavePolygonShape3D>(*shape)) { - warnings.push_back(RTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static.")); + warnings.push_back(vformat(RTR("When used for collision, ConcavePolygonShape3D is intended to work with static CollisionObject3D nodes like StaticBody3D.\nIt will likely not behave well for %ss (except when frozen and freeze_mode set to FREEZE_MODE_STATIC)."), body_type)); } else if (Object::cast_to<WorldBoundaryShape3D>(*shape)) { warnings.push_back(RTR("WorldBoundaryShape3D doesn't support RigidBody3D in another mode than static.")); } } + if (shape.is_valid() && Object::cast_to<CharacterBody3D>(col_object)) { + if (Object::cast_to<ConcavePolygonShape3D>(*shape)) { + warnings.push_back(RTR("When used for collision, ConcavePolygonShape3D is intended to work with static CollisionObject3D nodes like StaticBody3D.\nIt will likely not behave well for CharacterBody3Ds.")); + } + } + Vector3 scale = get_transform().get_basis().get_scale(); if (!(Math::is_zero_approx(scale.x - scale.y) && Math::is_zero_approx(scale.y - scale.z))) { warnings.push_back(RTR("A non-uniformly scaled CollisionShape3D node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change the size of its shape resource instead.")); |