diff options
| author | Jan Nils Ferner <contact@jnferner.com> | 2023-01-26 23:54:51 +0100 |
|---|---|---|
| committer | Jan Nils Ferner <contact@jnferner.com> | 2023-01-26 23:54:51 +0100 |
| commit | d5cd4fe4bc36feaae40a41f0d07d8bffae4383d5 (patch) | |
| tree | 689275f3651915376d353d9d1576ca74af46e898 /src | |
| parent | 848fe9f4735d776684cd5197be7f44817f4adc2a (diff) | |
| download | rapier-d5cd4fe4bc36feaae40a41f0d07d8bffae4383d5.tar.gz rapier-d5cd4fe4bc36feaae40a41f0d07d8bffae4383d5.tar.bz2 rapier-d5cd4fe4bc36feaae40a41f0d07d8bffae4383d5.zip | |
Only apply snap if necessary
Diffstat (limited to 'src')
| -rw-r--r-- | src/control/character_controller.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs index 8fb4b7f..ef8973c 100644 --- a/src/control/character_controller.rs +++ b/src/control/character_controller.rs @@ -342,7 +342,10 @@ impl KinematicCharacterController { filter, ) { // Apply the snap. - result.translation -= *self.up * (hit.toi - offset); + let snap_distance = hit.toi - offset; + if snap_distance.abs() > 1.0e-5 { + result.translation -= *self.up * snap_distance; + } result.grounded = true; return Some((hit_handle, hit)); } |
