DefaultModel

@three-blocks/proPresetDefaultMovement
const DefaultModel = { name: 'default', config: { gravity: 20, gravityFalling: 35, maxSpeed: 10, groundAccel: 12, airAccel: 1, airDrag: 2,...
Value
{ name: 'default', config: { gravity: 20, gravityFalling: 35, maxSpeed: 10, groundAccel: 12, airAccel: 1, airDrag: 2, friction: 4, stopSpeed: 1, jumpVelocity: 10, groundAngleThreshold: 0.7854, bhopFrictionMultiplier: 0.3, }, isGround( su...

Default Physics Model

Balanced physics suitable for third-person action games:

  • Moderate air control (less than ground)
  • Slightly faster fall for snappy landing
  • Standard ground friction

Uses the Quake-style architecture with balanced parameters.

Usage

Example
import { Physics, DefaultModel, PresetNames } from '@three-blocks/pro';

// Using the preset name (recommended)
const physics = new Physics( { physicsModel: PresetNames.DEFAULT } );

// Or using the model directly
const physics = new Physics( {
  physicsModel: 'custom',
  customPhysicsModel: DefaultModel
} );

// Access configuration
console.log( DefaultModel.config.maxSpeed ); // 10
console.log( DefaultModel.config.jumpVelocity ); // 10

Members

config#

Configuration - balanced third-person physics

Methods

isGround#

isGround(surfaceAngle : number) : boolean

Determine if surface is walkable ground

Parameters
surfaceAnglenumber
Angle from up vector in radians
Returns
boolean
  • True if walkable ground

groundMove#

groundMove(velocity : THREE.Vector3, wishDir : THREE.Vector3, wishSpeed : number, delta : number, isJumping : boolean)

Ground movement physics Responsive acceleration with standard friction

Parameters
velocityTHREE.Vector3
Current velocity (modified in place)
wishDirTHREE.Vector3
Input direction
wishSpeednumber
Input magnitude (0-1)
deltanumber
Time step
isJumpingboolean
Whether player is jumping this frame (for bhop friction bypass)

airMove#

airMove(velocity : THREE.Vector3, wishDir : THREE.Vector3, wishSpeed : number, delta : number)

Air movement physics Normal gravity when rising, faster fall for snappy landing

Parameters
velocityTHREE.Vector3
Current velocity (modified in place)
wishDirTHREE.Vector3
Input direction
wishSpeednumber
Input magnitude (0-1)
deltanumber
Time step

clipVelocity#

clipVelocity(velocity : THREE.Vector3, normal : THREE.Vector3)

Clip velocity against surface Standard clip without overbounce

Parameters
velocityTHREE.Vector3
Current velocity (modified in place)
normalTHREE.Vector3
Surface normal

jump#

jump(velocity : THREE.Vector3, onGround : boolean) : boolean

Handle jump

Parameters
velocityTHREE.Vector3
Current velocity (modified in place)
onGroundboolean
Whether player is on ground
Returns
boolean
  • True if jump was executed

clampVelocity#

clampVelocity(velocity : THREE.Vector3, maxVelocity : number)

Clamp velocity - separate horizontal and vertical This prevents moving while jumping from reducing jump height

Parameters
velocityTHREE.Vector3
Current velocity (modified in place)
maxVelocitynumber
Maximum velocity cap