From 42fe4309441760ab44fb195b23931d18f7fe4505 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sun, 12 Apr 2026 01:30:17 +0200 Subject: [PATCH] Update RapierCollisionWorld to include grounded probe and correct feet position calculation --- src/runtime-three/rapier-collision-world.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/runtime-three/rapier-collision-world.ts b/src/runtime-three/rapier-collision-world.ts index 2b7b54c5..7b593bac 100644 --- a/src/runtime-three/rapier-collision-world.ts +++ b/src/runtime-three/rapier-collision-world.ts @@ -500,6 +500,7 @@ export class RapierCollisionWorld { y: currentCenter.y + correctedMovement.y, z: currentCenter.z + correctedMovement.z }; + const nextFeetPosition = colliderCenterToFeetPosition(nextCenter, shape); const collisionCount = this.characterController.numComputedCollisions(); let groundCollisionNormal: Vec3 | null = null; @@ -520,12 +521,15 @@ export class RapierCollisionWorld { this.playerCollider.setTranslation(nextCenter); + const groundedProbe = this.probePlayerGround( + nextFeetPosition, + shape, + this.snapToGroundDistance + ); + return { - feetPosition: colliderCenterToFeetPosition(nextCenter, shape), - grounded: - this.characterController.computedGrounded() || - groundCollisionNormal !== null || - (motion.y < 0 && collidedAxes.y), + feetPosition: nextFeetPosition, + grounded: groundedProbe.grounded, collisionCount, groundCollisionNormal, collidedAxes