Skip to content

Commit

Permalink
Cache value of Jolt Physics project setting bounce_velocity_threshold
Browse files Browse the repository at this point in the history
(cherry picked from commit d6b822c)
  • Loading branch information
mihe authored and Spartan322 committed Jan 8, 2025
1 parent 882973e commit fbfeb04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2425,6 +2425,7 @@
</member>
<member name="physics/jolt_physics_3d/simulation/bounce_velocity_threshold" type="float" setter="" getter="" default="1.0">
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.
</member>
<member name="physics/jolt_physics_3d/simulation/continuous_cd_max_penetration" type="float" setter="" getter="" default="0.25">
Fraction of a body's inner radius that may penetrate another body while using continuous collision detection.
Expand Down
3 changes: 2 additions & 1 deletion modules/jolt_physics/jolt_project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,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() {
Expand Down

0 comments on commit fbfeb04

Please sign in to comment.