Skip to content

Commit

Permalink
should allow grounding with no up movement
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJanssens committed Apr 2, 2023
1 parent 89e3d76 commit b9e3433
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/control/character_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl KinematicCharacterController {
result: &mut EffectiveCharacterMovement,
) -> Option<(ColliderHandle, TOI)> {
if let Some(snap_distance) = self.snap_to_ground {
if result.translation.dot(&self.up) < -1.0e-5 {
if result.translation.dot(&self.up) <= 0.0 {
let snap_distance = snap_distance.eval(dims.y);
let offset = self.offset.eval(dims.y);
if let Some((hit_handle, hit)) = queries.cast_shape(
Expand Down

1 comment on commit b9e3433

@ChrisJanssens
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we are taking the dot product of the movement and up direction here to ensure the vector is negative to the up direction. Is this necessary? I was using grounded to determine when my character controller can "jump". Allowing this value to be zero or lower allows my character controller lateral movement along a collider that is on the opposed side of my character to that of the up direction.

Please sign in to comment.