Skip to content

Commit 84b66d6

Browse files
fix: character controller: walls less likely to trigger ground detection (#655)
1 parent 5c6d34a commit 84b66d6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/control/character_controller.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,9 @@ impl KinematicCharacterController {
519519
) -> bool {
520520
let normal = -(character_pos * manifold.local_n1);
521521

522-
if normal.dot(&self.up) >= 1.0e-5 {
522+
// For the controller to be grounded, the angle between the contact normal and the up vector
523+
// has to be smaller than acos(1.0e-3) = 89.94 degrees.
524+
if normal.dot(&self.up) >= 1.0e-3 {
523525
let prediction = self.predict_ground(dims.y);
524526
for contact in &manifold.points {
525527
if contact.dist <= prediction {

0 commit comments

Comments
 (0)