Sets acceleration/deceleration in units/sec^2 (0.0=instant, >0=gradual speed change, default 0.0).
Takes characterHandle (character controller from b3dCreateCharacterController), acceleration (rate of speed increase in units per second squared, how fast character reaches target speed when starting or speeding up), deceleration (rate of speed decrease in units per second squared, how fast character stops or slows down).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
characterHandleInt
accelerationDouble
decelerationDouble
Returns
Void
Quick Summary
Sets acceleration/deceleration in units/sec^2 (0.0=instant, >0=gradual speed change, default 0.0).
Takes characterHandle (character controller from b3dCreateCharacterController), acceleration (rate of speed increase in units per second squared, how fast character reaches target speed when starting or speeding up), deceleration (rate of speed decrease in units per second squared, how fast character stops or slows down).
Returns nothing.
Technical Exegesis...
Sets acceleration/deceleration in units/sec^2 (0.0=instant, >0=gradual speed change, default 0.0). Takes characterHandle (character controller from b3dCreateCharacterController), acceleration (rate of speed increase in units per second squared, how fast character reaches target speed when starting or speeding up), deceleration (rate of speed decrease in units per second squared, how fast character stops or slows down). Returns nothing. Sets data.acceleration and data.
Sets acceleration/deceleration in units/sec^2 (0.0=instant, >0=gradual speed change, default 0.0). Takes characterHandle (character controller from b3dCreateCharacterController), acceleration (rate of speed increase in units per second squared, how fast character reaches target speed when starting or speeding up), deceleration (rate of speed decrease in units per second squared, how fast character stops or slows down). Returns nothing. Sets data.acceleration and data.deceleration, affects b3dMoveCharacter velocity smoothing. Use to create responsive or weighty character movement feel.
This function configures acceleration. Acceleration system: when character input changes (start moving, change direction, stop), velocity doesn't change instantly (unless acceleration = 0.0), instead velocity smoothly transitions from current to target (gradual speed change based on acceleration/deceleration rate), creates realistic or weighty movement feel (characters accelerate like real objects, not instant teleport). Acceleration parameter: acceleration >= 0.0 in units/sec^2 (rate of speed increase when accelerating, how fast velocity increases toward target), 0.0 = instant acceleration (velocity jumps to target immediately, no smooth transition, default), 20.0 typical value for smooth acceleration (reaches full speed in ~0.5 seconds from standstill), higher values faster acceleration (reaches target speed quicker, snappier feel). Deceleration parameter: deceleration >= 0.0 in units/sec^2 (rate of speed decrease when decelerating, how fast velocity decreases toward target or zero), 0.0 = instant deceleration (velocity drops to target immediately, no smooth transition, default), 30.0 typical value for smooth deceleration (stops in ~0.3 seconds from full speed), higher values faster deceleration (stops quicker, more responsive). Use cases: (1) Realistic movement (acceleration simulates inertia, characters feel weighty), (2) Ice physics (low deceleration creates slippery sliding feel), (3) Responsive controls (high acceleration/deceleration for snappy movement), (4) Heavy characters (low acceleration makes character feel massive and sluggish), (5) Vehicle-like movement (moderate acceleration/deceleration simulates driving physics). Common patterns: instant movement b3dSetCharacterAcceleration(char, 0.0, 0.0), smooth movement b3dSetCharacterAcceleration(char, 20.0, 30.0), ice physics b3dSetCharacterAcceleration(char, 15.0, 5.0), heavy character b3dSetCharacterAcceleration(char, 10.0, 15.0), snappy controls b3dSetCharacterAcceleration(char, 50.0, 50.0). Typical usage: set once at character creation (configure character movement feel), adjust for surface types (ice has low deceleration, mud has low acceleration), modify for powerups or status effects (boost increases acceleration temporarily).
Default values: acceleration = 0.0, deceleration = 0.0 (instant velocity changes, set in b3dCreateCharacterController), remain until explicitly changed (persistent across frames), provides immediate responsive feel (no smoothing, direct input to movement). Acceleration vs deceleration: acceleration used when speeding up (velocity magnitude increasing, starting from stop or increasing speed), deceleration used when slowing down (velocity magnitude decreasing, stopping or reducing speed), separate values allow asymmetric feel (can stop faster than start or vice versa). Zero acceleration/deceleration (0.0, 0.0): velocity changes instantly to match input (no smoothing or ramping), character moves and stops immediately (perfectly responsive, arcade feel), default behavior (b3dCreateCharacterController initializes both to 0.0), useful for precise platforming (tight controls, no momentum). Non-zero acceleration: velocity gradually increases toward target speed (smooth ramp-up from standstill or lower speed), time to reach target = targetSpeed / acceleration (example 10 units/sec speed with 20 accel = 0.5 seconds to full speed), creates weighty feel (character has mass, takes time to get going), realistic movement (simulates inertia and friction). Non-zero deceleration: velocity gradually decreases toward target speed or zero (smooth ramp-down when stopping or slowing), time to stop = currentSpeed / deceleration (example 10 units/sec speed with 30 decel = 0.33 seconds to stop), creates momentum feel (character slides to stop, not instant halt), can simulate friction (higher deceleration = more friction, stops faster). Parameter clamping: if acceleration < 0.0 clamped to 0.0 (negative values become instant, prevents reverse acceleration), if deceleration < 0.0 clamped to 0.0 (negative values become instant, prevents reverse deceleration), valid range >= 0.0 only (zero or positive, no negative acceleration). Smooth movement example: b3dSetCharacterAcceleration(char, 20.0, 30.0) (moderate smoothing), starting from rest takes 0.5 sec to reach 10 units/sec (10/20=0.5), stopping from 10 units/sec takes 0.33 sec (10/30=0.33), responsive but not instant (slight momentum feel). Ice physics example: b3dSetCharacterAcceleration(char, 15.0, 5.0) (normal start, slow stop), accelerates normally (15 units/sec^2 reasonable startup), decelerates slowly (5 units/sec^2 slippery stop), creates ice sliding feel (easy to start, hard to stop, character slides on ice surface). Heavy character example: b3dSetCharacterAcceleration(char, 8.0, 12.0) (slow start and stop), accelerates slowly (8 units/sec^2 feels massive), decelerates moderately (12 units/sec^2 heavy momentum), weighty character feel (tank or large creature, sluggish movement). Velocity calculation: each frame calculate desired velocity (input direction * current speed from movement state), if accelerating (desired magnitude > current magnitude) apply acceleration (velocity += acceleration * deltaTime toward desired), if decelerating (desired magnitude < current magnitude) apply deceleration (velocity -= deceleration * deltaTime toward desired), clamp to target (don't overshoot desired velocity). Direction changes: changing direction while moving uses deceleration then acceleration (first decelerate to zero in old direction, then accelerate in new direction), creates realistic turning (can't instantly reverse, must slow then accelerate), 180 degree turn takes decel time + accel time (full stop then restart in opposite direction). Air control interaction: acceleration/deceleration still apply when airborne (velocity smoothing works in air too), combined with air control (air control scales target velocity, accel/decel smooth to scaled target), creates smooth aerial movement (gradual speed changes while jumping or falling). Movement state changes: when switching movement state (walk to run or run to crouch), target speed changes (new state has different speed), acceleration/deceleration smooth transition (don't jump instantly to new speed, ramp up or down), smooth speed transitions (walk to run gradually speeds up, run to walk gradually slows). Realistic values: human movement acceleration 10-30 units/sec^2 typical (2-3 m/s^2 realistic for running start), deceleration 20-50 units/sec^2 typical (friction stops faster than muscle accelerates), game feel often faster (40-60 units/sec^2 for responsive controls). High acceleration example: b3dSetCharacterAcceleration(char, 100.0, 100.0) (near-instant but not quite), reaches full speed in 0.1 seconds (very snappy, almost arcade-like), minimal smoothing (just enough to prevent instant teleport), competitive/action game feel. Low acceleration example: b3dSetCharacterAcceleration(char, 5.0, 5.0) (very gradual smoothing), reaches full speed in 2 seconds (slow ramp-up, very weighty), heavy momentum feel (character feels massive, sluggish but realistic), simulation or tank controls. Performance: O(1) operation (simple float assignment with clamping, instant), clamping cost negligible (comparisons and assignments per value), acceleration applied each frame in UpdatePhysicsSystem (velocity calculation cost ~3 operations per frame). Validation: silently returns if characterHandle not found in g_characters (invalid or freed character), clamps acceleration and deceleration to >= 0.0 (ensures valid non-negative values), no error messages (silent failure for performance). Related: b3dMoveCharacter uses acceleration/deceleration for velocity smoothing (applies gradual speed changes), b3dSetCharacterMoveSpeed sets target speeds (acceleration determines how fast these speeds are reached), b3dSetCharacterAirControl combines with acceleration (air control scales target, accel smooths transition), b3dCreateCharacterController initializes acceleration to 0.0 (instant movement default).