Adjust AUTOSTEP_PLANAR_PROGRESS_EPSILON and add closeSupportProbeDistance calculation in RapierCollisionWorld

This commit is contained in:
2026-04-12 02:30:46 +02:00
parent b1d7720cdd
commit 872ec223ea

View File

@@ -22,7 +22,7 @@ const CHARACTER_CONTROLLER_OFFSET = 0.01;
const CHARACTER_CONTROLLER_SNAP_TO_GROUND_DISTANCE = 0.2;
const AUTOSTEP_MIN_WIDTH_FACTOR = 0.4285714286;
const AUTOSTEP_SURFACE_PROBE_DISTANCE = 0.08;
const AUTOSTEP_PLANAR_PROGRESS_EPSILON = 0.02;
const AUTOSTEP_PLANAR_PROGRESS_EPSILON = 0.005;
const COLLISION_EPSILON = 1e-5;
const CAMERA_COLLISION_EPSILON = 1e-3;
const MAX_WALKABLE_SLOPE_RADIANS = Math.PI * 0.25;
@@ -562,10 +562,17 @@ export class RapierCollisionWorld {
(resolved.collidedAxes.x || resolved.collidedAxes.z)
) {
const withoutAutostep = computeResolvedMovement(motion, false);
const closeSupportProbeDistance = Math.min(
this.snapToGroundDistance,
Math.max(
AUTOSTEP_SURFACE_PROBE_DISTANCE,
(this.autostepHeight ?? AUTOSTEP_SURFACE_PROBE_DISTANCE) * 0.5
)
);
const landedOnStepSurface = this.probePlayerGround(
resolved.nextFeetPosition,
shape,
AUTOSTEP_SURFACE_PROBE_DISTANCE
closeSupportProbeDistance
).grounded;
const improvedPlanarDistance =
computePlanarDistance(resolved.correctedMovement) >