RealisticModel
const RealisticModel = { name: 'realistic', config: { gravity: 32, maxSpeed: 8, groundAccel: 10, airAccel: 0.5, friction: 4.8, stopSpeed: 1,...Realistic Physics Model
Simulation-style physics with:
- Almost no air control (committed movement)
- Heavier gravity feel
- Higher ground friction for immediate stops
- Lower, more realistic jump height
Best for:
- Simulation-style games
- Tactical shooters
- Games requiring committed movement decisions
Usage
Example
import { Physics, RealisticModel, PresetNames } from '@three-blocks/pro';
// Using the preset name
const physics = new Physics( { physicsModel: PresetNames.REALISTIC } );
// Or using the model directly
const physics = new Physics( {
physicsModel: 'custom',
customPhysicsModel: RealisticModel
} );
// Access configuration
console.log( RealisticModel.config.gravity ); // 32 (heavier)
console.log( RealisticModel.config.airAccel ); // 0.5 (minimal air control)
Members
config#
Configuration - Realistic simulation physics
Methods
isGround#
isGround(surfaceAngle : number) : booleanDetermine if surface is walkable ground
Parameters
surfaceAnglenumberAngle 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 Higher friction for immediate stops
Parameters
velocityTHREE.Vector3Current velocity (modified in place)
wishDirTHREE.Vector3Input direction
wishSpeednumberInput magnitude (0-1)
deltanumberTime step
isJumpingbooleanWhether player is jumping this frame (for bhop friction bypass)
airMove#
airMove(velocity : THREE.Vector3, wishDir : THREE.Vector3, wishSpeed : number, delta : number)Air movement physics Almost no air control - once you jump, you're committed
Parameters
velocityTHREE.Vector3Current velocity (modified in place)
wishDirTHREE.Vector3Input direction
wishSpeednumberInput magnitude (0-1)
deltanumberTime step
clipVelocity#
clipVelocity(velocity : THREE.Vector3, normal : THREE.Vector3)Clip velocity against surface Standard clip without overbounce
Parameters
velocityTHREE.Vector3Current velocity (modified in place)
normalTHREE.Vector3Surface normal
jump#
jump(velocity : THREE.Vector3, onGround : boolean) : booleanHandle jump Lower, more realistic jump
Parameters
velocityTHREE.Vector3Current velocity (modified in place)
onGroundbooleanWhether player is on ground
Returns
boolean — - True if jump was executed