aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics/integration_parameters.rs
diff options
context:
space:
mode:
authorEmil Ernerfeldt <emil.ernerfeldt@gmail.com>2021-02-15 20:52:16 +0100
committerEmil Ernerfeldt <emil.ernerfeldt@gmail.com>2021-02-26 11:06:29 +0100
commit21247a123691de7a5f53454c7edba838af83c594 (patch)
treec9d30057755ce91c581845af1eefe0e19b0a0c9f /src/dynamics/integration_parameters.rs
parent1c5601c84bf5ca3b7fd611cc4b4fd7030526f71f (diff)
downloadrapier-21247a123691de7a5f53454c7edba838af83c594.tar.gz
rapier-21247a123691de7a5f53454c7edba838af83c594.tar.bz2
rapier-21247a123691de7a5f53454c7edba838af83c594.zip
Add restorative impulse in velocity solver
Diffstat (limited to 'src/dynamics/integration_parameters.rs')
-rw-r--r--src/dynamics/integration_parameters.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/dynamics/integration_parameters.rs b/src/dynamics/integration_parameters.rs
index caad9b5..96d9eaf 100644
--- a/src/dynamics/integration_parameters.rs
+++ b/src/dynamics/integration_parameters.rs
@@ -27,6 +27,19 @@ pub struct IntegrationParameters {
/// Each cached impulse are multiplied by this coefficient in `[0, 1]`
/// when they are re-used to initialize the solver (default `1.0`).
pub warmstart_coeff: Real,
+
+ /// 0-1: how much of the velocity to dampen out in the constraint solver?
+ /// (default `1.0`).
+ pub velocity_solve_fraction: Real,
+
+ /// 0-1: multiplier for how much of the constraint violation (e.g. contact penetration)
+ /// will be compensated for during the velocity solve.
+ /// If zero, you need to enable the positional solver.
+ /// If non-zero, you do not need the positional solver.
+ /// A good non-zero value is around `0.2`.
+ /// (default `0.0`).
+ pub velocity_based_erp: Real,
+
/// Amount of penetration the engine wont attempt to correct (default: `0.005m`).
pub allowed_linear_error: Real,
/// The maximal distance separating two objects that will generate predictive contacts (default: `0.002`).
@@ -121,17 +134,12 @@ impl IntegrationParameters {
max_stabilization_multiplier,
max_velocity_iterations,
max_position_iterations,
- // FIXME: what is the optimal value for min_island_size?
- // It should not be too big so that we don't end up with
- // huge islands that don't fit in cache.
- // However we don't want it to be too small and end up with
- // tons of islands, reducing SIMD parallelism opportunities.
- min_island_size: 128,
max_ccd_position_iterations,
max_ccd_substeps,
return_after_ccd_substep,
multiple_ccd_substep_sensor_events_enabled,
ccd_on_penetration_enabled,
+ ..Default::default()
}
}
@@ -183,6 +191,8 @@ impl Default for IntegrationParameters {
return_after_ccd_substep: false,
erp: 0.2,
joint_erp: 0.2,
+ velocity_solve_fraction: 1.0,
+ velocity_based_erp: 0.0,
warmstart_coeff: 1.0,
allowed_linear_error: 0.005,
prediction_distance: 0.002,