Sets movement speeds for walk/run/crouch states (units/sec, defaults 5.0/10.0/2.5).
Takes characterHandle (character controller from b3dCreateCharacterController), walkSpeed (movement speed in walk state units per second), runSpeed (movement speed in run state units per second), crouchSpeed (movement speed in crouch state units per second).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
characterHandleInt
walkSpeedDouble
runSpeedDouble
crouchSpeedDouble
Returns
Void
Quick Summary
Sets movement speeds for walk/run/crouch states (units/sec, defaults 5.0/10.0/2.5).
Takes characterHandle (character controller from b3dCreateCharacterController), walkSpeed (movement speed in walk state units per second), runSpeed (movement speed in run state units per second), crouchSpeed (movement speed in crouch state units per second).
Returns nothing.
Technical Exegesis...
Sets movement speeds for walk/run/crouch states (units/sec, defaults 5.0/10.0/2.5). Takes characterHandle (character controller from b3dCreateCharacterController), walkSpeed (movement speed in walk state units per second), runSpeed (movement speed in run state units per second), crouchSpeed (movement speed in crouch state units per second). Returns nothing. Sets data.walkSpeed, data.runSpeed, data.crouchSpeed for movement state system.
Sets movement speeds for walk/run/crouch states (units/sec, defaults 5.0/10.0/2.5). Takes characterHandle (character controller from b3dCreateCharacterController), walkSpeed (movement speed in walk state units per second), runSpeed (movement speed in run state units per second), crouchSpeed (movement speed in crouch state units per second). Returns nothing. Sets data.walkSpeed, data.runSpeed, data.crouchSpeed for movement state system. Use to customize character movement capabilities per character type or gameplay context.
This function configures movement speeds. Movement state system: character has current movement state (0=walk, 1=run, 2=crouch, set by b3dSetCharacterMovementState), each state has associated speed (walk uses walkSpeed, run uses runSpeed, crouch uses crouchSpeed), b3dMoveCharacter uses current state's speed to scale movement (actual velocity = input direction * current speed). Speed parameters: walkSpeed = normal walking speed in units/sec (moderate pace, default 5.0 realistic human walk), runSpeed = sprint/running speed in units/sec (fast pace, default 10.0 athletic run), crouchSpeed = sneaking/crouched speed in units/sec (slow pace, default 2.5 cautious crouch). Use cases: (1) Character differentiation (fast characters higher speeds, slow characters lower), (2) Powerups (speed boost increases all speeds temporarily), (3) Status effects (slowdown reduces speeds, haste increases), (4) Difficulty settings (easy mode faster movement, hard mode slower), (5) Character progression (level up increases movement speeds). Common patterns: fast character b3dSetCharacterMoveSpeed(athlete, 7.0, 14.0, 3.5), slow character b3dSetCharacterMoveSpeed(heavy, 3.0, 6.0, 1.5), speed powerup b3dSetCharacterMoveSpeed(char, walk*1.5, run*1.5, crouch*1.5), slowdown b3dSetCharacterMoveSpeed(char, walk*0.5, run*0.5, crouch*0.5). Typical usage: set once at character creation (configure character-specific movement speeds), adjust dynamically for powerups or status effects (temporary speed changes), reset after effect expires (restore normal speeds).
Default values: walkSpeed=5.0, runSpeed=10.0, crouchSpeed=2.5 (set in b3dCreateCharacterController initialization), remain until explicitly changed (persistent across frames), typical for human-sized characters in realistic games. Speed ratios: run typically 2x walk (runSpeed = walkSpeed * 2, sprint is double walking pace), crouch typically 0.5x walk (crouchSpeed = walkSpeed * 0.5, sneaking is half walking pace), maintain proportions when scaling (if boosting speed multiply all by same factor). Movement state interaction: current state determines which speed is used (walk state uses walkSpeed, run state uses runSpeed, crouch state uses crouchSpeed), switch state with b3dSetCharacterMovementState (change between walk/run/crouch), b3dMoveCharacter reads current state's speed (applies speed to input velocity). Walk state (0): uses walkSpeed for moderate pace (default 5.0 units/sec), typical for exploration and careful movement (balanced speed and control), common for non-combat situations (normal game navigation). Run state (1): uses runSpeed for fast pace (default 10.0 units/sec), typical for combat and traversal (fast movement sacrifices stealth), common for action situations (chase, escape, quick navigation). Crouch state (2): uses crouchSpeed for slow pace (default 2.5 units/sec), typical for stealth and precision (slow movement gains stealth advantage), common for sneaking situations (avoid detection, careful approach). Speed units: units per second in world space (5.0 = 5 world units per second), if 1 unit = 1 meter then 5.0 = 5 m/s realistic walking (average human walk ~1.4 m/s but game feel often faster), adjust to match game scale and feel (tune for responsiveness and realism balance). Speed recommendations: walkSpeed 3.0-7.0 typical (3.0 slow cautious, 5.0 normal, 7.0 brisk), runSpeed 6.0-15.0 typical (6.0 jog, 10.0 sprint, 15.0 superhuman), crouchSpeed 1.5-4.0 typical (1.5 very slow sneak, 2.5 normal crouch, 4.0 fast crouch). Zero or negative speeds: zero speed prevents movement in that state (character can't move when in state 0/1/2 if corresponding speed is 0.0), negative speed causes backward movement (unconventional, probably unintended, no clamping), avoid non-positive speeds for normal movement (validate speed > 0 before calling). Acceleration interaction: speeds define maximum velocity (target speed for acceleration to reach), acceleration/deceleration determine how fast speed is reached (b3dSetCharacterAcceleration controls ramp-up/ramp-down), instant acceleration (0.0) jumps to full speed immediately (no smooth transition). Powerup example: boost all speeds by 50% (newWalk = walk * 1.5, newRun = run * 1.5, newCrouch = crouch * 1.5), store original speeds (save walk/run/crouch before boost for restoration), restore after duration (b3dSetCharacterMoveSpeed(char, origWalk, origRun, origCrouch) when effect ends). Status effect example: slowdown reduces all speeds by 30% (newWalk = walk * 0.7, newRun = run * 0.7, newCrouch = crouch * 0.7), haste increases all speeds by 200% (newWalk = walk * 2.0, newRun = run * 2.0, newCrouch = crouch * 2.0), combine effects multiplicatively (slow+haste: speed * 0.7 * 2.0 = speed * 1.4). Performance: O(1) operation (simple float assignment, three values set), no validation overhead (any values allowed including zero or negative), safe to call every frame if needed (though typically set infrequently). Validation: silently returns if characterHandle not found in g_characters (invalid or freed character), no speed validation (any values allowed, user responsible for reasonable speeds), no error messages (silent failure for performance). Related: b3dSetCharacterMovementState switches between walk/run/crouch (selects which speed is active), b3dMoveCharacter uses current state's speed for movement (applies speed to velocity), b3dCreateCharacterController sets default speeds (initial values 5.0, 10.0, 2.5), b3dSetCharacterAcceleration affects how fast speed is reached (ramp-up to target speed).