Sets character controller stick-to-floor distance for slope handling.
Takes characterHandle (character controller from b3dCreateCharacterPhysics), distance (stick distance in units, how far down to search for floor).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
characterHandleInt
distanceDouble
Returns
Void
Quick Summary
Sets character controller stick-to-floor distance for slope handling.
Takes characterHandle (character controller from b3dCreateCharacterPhysics), distance (stick distance in units, how far down to search for floor).
Returns nothing.
Technical Exegesis...
Sets character controller stick-to-floor distance for slope handling. Takes characterHandle (character controller handle from b3dCreateCharacterPhysics or similar), distance (stick-to-floor distance in units as Double, how far below character to search for ground contact, typical 0.1-0.5). Returns nothing. Configures Jolt character controller ground adhesion behavior.
Sets character controller stick-to-floor distance for slope handling. Takes characterHandle (character controller handle from b3dCreateCharacterPhysics or similar), distance (stick-to-floor distance in units as Double, how far below character to search for ground contact, typical 0.1-0.5). Returns nothing. Configures Jolt character controller ground adhesion behavior.
Stick-to-floor: keeps character grounded on slopes and stairs (raycasts down from character position up to 'distance' units, if ground found within distance, character position adjusted to stay on ground, prevents character floating or bouncing on uneven terrain). Purpose: smooth movement on slopes (character stays firmly planted on ground, no air gaps when walking downhill or down stairs), prevents small jumps (character doesn't leave ground on minor terrain variations).
Distance parameter: how far down to search for floor (distance = 0.1 to 0.5 typical for human character, larger distance = sticks to steeper slopes/bigger drops, smaller distance = less aggressive sticking, only very close ground), trade-off (too large = character "glued" to ground, hard to jump or fall, too small = character bounces on stairs or slopes). Typical values: 0.1-0.2 for tight control (character can leave ground easily, less aggressive sticking), 0.3-0.4 for smooth slopes (good balance, comfortable stair descent), 0.5+ for aggressive sticking (rarely leaves ground, very smooth on rough terrain but may feel restrictive).
Slope handling: stick-to-floor helps descend slopes smoothly (without it, character may "hop" down slopes in stair-step fashion, with it, character slides smoothly down maintaining ground contact), stairs (keeps character grounded on each step, prevents bouncing between steps). Jump interaction: stick-to-floor may resist jumping (character pulled back to ground if jump velocity insufficient, adjust distance or disable temporarily during jump for better jump feel).
Use cases: (1) FPS character (smooth movement on terrain and stairs), (2) Third-person character (prevent floating above ground on slopes), (3) Platformer character (optional, may want less sticking for jump precision), (4) Walking simulator (high stick distance for very smooth ground following). Common patterns: balanced sticking (b3dSetCharacterStickToFloor(character, 0.3)), tight control (distance 0.1 for precise movement), smooth terrain (distance 0.5 for rough outdoor terrain).
Physics: character controller raycasts down distance units each frame (checks for ground within range, adjusts character Y position to maintain ground contact), integrates with character movement (applied after horizontal movement, keeps character on ground during walk/run). Performance: minimal overhead (single raycast down per frame, integrated into character controller update).
Validation: silently returns if characterHandle invalid (character controller not found), no validation on distance (negative values may cause unexpected behavior, use positive values 0-1 typical). Related: b3dCreateCharacterPhysics creates character controller (call before this function to get characterHandle), b3dSetCharacterVelocity controls character movement (stick-to-floor affects how velocity translates to position on slopes).