combinePresets

@three-blocks/pro
combinePresets(name : string, presetConfigs : Array<{condition: function(BodyState): boolean, preset: PhysicsModel}>, fallback : PhysicsModel) : PhysicsModel

Combines multiple presets by using the first matching non-null result.

Note: This utility targets legacy presets that expose getForceMultiplier, getGravityBonus, getFriction, and getJumpVelocity.

Parameters
namestring
Name for the combined preset.
presetConfigsArray<{condition: function(BodyState): boolean, preset: PhysicsModel}>
fallbackPhysicsModel
Fallback preset if no conditions match.
Returns
PhysicsModel
Example
const conditionalPreset = combinePresets( 'conditional', [
  { condition: ( state ) => state.sliding, preset: slipperyLegacyModel },
], fallbackLegacyModel );