From d6b822c891c9d6b119a0521720f1a55ad455af57 Mon Sep 17 00:00:00 2001 From: Mikael Hermansson Date: Tue, 7 Jan 2025 18:35:04 +0100 Subject: [PATCH] Cache value of Jolt Physics project setting `bounce_velocity_threshold` --- doc/classes/ProjectSettings.xml | 1 + modules/jolt_physics/jolt_project_settings.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 60e31d3f54d..7a58321fd00 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -2464,6 +2464,7 @@ The minimum velocity needed before a collision can be bouncy, in meters per second. + [b]Note:[/b] This setting will only be read once during the lifetime of the application. Fraction of a body's inner radius that may penetrate another body while using continuous collision detection. diff --git a/modules/jolt_physics/jolt_project_settings.cpp b/modules/jolt_physics/jolt_project_settings.cpp index 54a7140f10a..7362967ea11 100644 --- a/modules/jolt_physics/jolt_project_settings.cpp +++ b/modules/jolt_physics/jolt_project_settings.cpp @@ -119,7 +119,8 @@ float JoltProjectSettings::get_soft_body_point_radius() { } float JoltProjectSettings::get_bounce_velocity_threshold() { - return GLOBAL_GET("physics/jolt_physics_3d/simulation/bounce_velocity_threshold"); + static const float value = GLOBAL_GET("physics/jolt_physics_3d/simulation/bounce_velocity_threshold"); + return value; } bool JoltProjectSettings::is_sleep_allowed() {