From 413689559c4a6673e5d191d1c63e88964c15c449 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 2 Mar 2022 01:10:18 +0100 Subject: [PATCH] Always register the Smooth Trimesh Collision project setting This ensures the project setting never disappears from the editor, even if the current physics engine is GodotPhysics. This also adds documentation for the Smooth Trimesh Collision project setting. --- core/project_settings.cpp | 4 ++++ doc/classes/ProjectSettings.xml | 4 ++++ modules/bullet/shape_bullet.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 1b2cf65dbcf..6de99c2ea57 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -1258,6 +1258,10 @@ ProjectSettings::ProjectSettings() { custom_prop_info["physics/2d/thread_model"] = PropertyInfo(Variant::INT, "physics/2d/thread_model", PROPERTY_HINT_ENUM, "Single-Unsafe,Single-Safe,Multi-Threaded"); custom_prop_info["rendering/quality/intended_usage/framebuffer_allocation"] = PropertyInfo(Variant::INT, "rendering/quality/intended_usage/framebuffer_allocation", PROPERTY_HINT_ENUM, "2D,2D Without Sampling,3D,3D Without Effects"); + // Required to make the project setting appear even if the physics engine is GodotPhysics, + // while also making it appear in the ProjectSettings class documentation. + GLOBAL_DEF("physics/3d/smooth_trimesh_collision", false); + GLOBAL_DEF("rendering/quality/filters/sharpen_intensity", 0.0); custom_prop_info["rendering/quality/filters/sharpen_intensity"] = PropertyInfo(Variant::REAL, "rendering/quality/filters/sharpen_intensity", PROPERTY_HINT_RANGE, "0,1"); diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index c7e413b868f..f53305d05d0 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -1138,6 +1138,10 @@ Sets which physics engine to use for 3D physics. "DEFAULT" is currently the [url=https://bulletphysics.org]Bullet[/url] physics engine. The "GodotPhysics" engine is still supported as an alternative. + + If [code]true[/code], smooths out collision with trimesh shapes ([ConcavePolygonShape]) by telling the Bullet physics engine to generate internal edge information for every trimesh shape created. + [b]Note:[/b] Only effective if [member physics/3d/physics_engine] is set to [code]DEFAULT[/code] or [code]Bullet[/code], [i]not[/i] [code]GodotPhysics[/code]. + Enables [member Viewport.physics_object_picking] on the root viewport. diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index 55782ae6e5b..6c52d755cdc 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -422,7 +422,7 @@ void ConcavePolygonShapeBullet::setup(PoolVector p_faces) { meshShape = bulletnew(btBvhTriangleMeshShape(shapeInterface, useQuantizedAabbCompression)); - if (GLOBAL_DEF("physics/3d/smooth_trimesh_collision", false)) { + if (GLOBAL_GET("physics/3d/smooth_trimesh_collision")) { btTriangleInfoMap *triangleInfoMap = new btTriangleInfoMap(); btGenerateInternalEdgeInfo(meshShape, triangleInfoMap); }