fix: character controller: walls less likely to trigger ground detection (#655)

This commit is contained in:
Thierry Berger
2024-06-17 16:51:06 +02:00
committed by GitHub
parent 5c6d34aa09
commit 84b66d63e3

View File

@@ -519,7 +519,9 @@ impl KinematicCharacterController {
) -> bool { ) -> bool {
let normal = -(character_pos * manifold.local_n1); let normal = -(character_pos * manifold.local_n1);
if normal.dot(&self.up) >= 1.0e-5 { // For the controller to be grounded, the angle between the contact normal and the up vector
// has to be smaller than acos(1.0e-3) = 89.94 degrees.
if normal.dot(&self.up) >= 1.0e-3 {
let prediction = self.predict_ground(dims.y); let prediction = self.predict_ground(dims.y);
for contact in &manifold.points { for contact in &manifold.points {
if contact.dist <= prediction { if contact.dist <= prediction {