Skip to main content

PhysicsConfig

Index

Properties

optionalarcade

arcade?: { contactSolveBias?: ContactSolveBias }

Configure the ArcadeSolver


Type declaration

optionalbodies

bodies?: { canSleepByDefault?: boolean; defaultMass?: number; sleepBias?: number; sleepEpsilon?: number; wakeThreshold?: number }

Configure body defaults


Type declaration

  • optionalcanSleepByDefault?: boolean

    By default bodies do not sleep, this can be turned on to improve perf if you have a lot of bodies.

    Default false

  • optionaldefaultMass?: number

    Configure default mass that bodies have

    Default 10 mass units

  • optionalsleepBias?: number

    Sleep bias

    Default 0.9

  • optionalsleepEpsilon?: number

    Sleep epsilon

    Default 0.07

  • optionalwakeThreshold?: number

    Wake Threshold, the amount of "motion" need to wake a body from sleep

    Default 0.07 * 3;

optionalcolliders

colliders?: { compositeStrategy?: separate | together }

Configure colliders


Type declaration

  • optionalcompositeStrategy?: separate | together

    Treat composite collider's member colliders as either separate colliders for the purposes of onCollisionStart/onCollision or as a single collider together.

    This property can be overridden on individual CompositeColliders.

    For composites without gaps or small groups of colliders, you probably want 'together'

    For composites with deliberate gaps, like a platforming level layout, you probably want 'separate'

    Default is 'together' if unset

optionalcontinuous

continuous?: { checkForFastBodies?: boolean; disableMinimumSpeedForFastBody?: boolean; surfaceEpsilon?: number }

Configure excalibur continuous collision (WIP)


Type declaration

  • optionalcheckForFastBodies?: boolean

    Enable fast moving body checking, this enables checking for collision pairs via raycast for fast moving objects to prevent bodies from tunneling through one another.

    Default true

  • optionaldisableMinimumSpeedForFastBody?: boolean

    Disable minimum fast moving body raycast, by default if checkForFastBodies = true Excalibur will only check if the body is moving at least half of its minimum dimension in an update. If disableMinimumSpeedForFastBody is set to true, Excalibur will always perform the fast body raycast regardless of speed.

    Default false

  • optionalsurfaceEpsilon?: number

    Surface epsilon is used to help deal with predicting collisions by applying a slop

    Default 0.1

optionaldynamicTree

dynamicTree?: DynamicTreeConfig

optionalenabled

enabled?: boolean

Excalibur physics simulation is enabled

optionalgravity

gravity?: Vector

Configure gravity that applies to all CollisionType.Active bodies.

This is acceleration in pixels/sec^2

Default vec(0, 0)

BodyComponent.useGravity to opt out

optionalrealistic

realistic?: { positionIterations?: number; slop?: number; steeringFactor?: number; velocityIterations?: number; warmStart?: boolean }

Configure the RealisticSolver


Type declaration

  • optionalpositionIterations?: number

    Number of position iterations (overlap) to run in the solver

    Default 3 iterations

  • optionalslop?: number

    Amount of overlap to tolerate in pixels

    Default 1 pixel

  • optionalsteeringFactor?: number

    Amount of positional overlap correction to apply each position iteration of the solver 0 - meaning no correction, 1 - meaning correct all overlap. Generally values 0 < .5 look nice.

    Default 0.2

  • optionalvelocityIterations?: number

    Number of velocity iteration (response) to run in the solver

    Default 8 iterations

  • optionalwarmStart?: boolean

    Warm start set to true re-uses impulses from previous frames back in the solver. Re-using impulses helps the solver converge quicker

    Default true

optionalsolver

Configure the type of physics simulation you would like

Default is Arcade

optionalsparseHashGrid

sparseHashGrid?: SparseHashGridConfig

optionalspatialPartition

spatialPartition?: SpatialPartitionStrategy

Configure the spatial data structure for locating pairs and raycasts

optionalsubstep

substep?: number

Configure physics sub-stepping, this can increase simulation fidelity by doing smaller physics steps

Default is 1 step