Skip to main content

Physics

The [[Physics]] object is the global configuration object for all Excalibur physics.

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

Index

Constructors

constructor

Properties

publicstaticacc

acc: Vector = ...

Global acceleration that is applied to all vanilla actors that have a [[CollisionType.Active|active]] collision type. Global acceleration won't effect [[Label|labels]], [[ScreenElement|ui actors]], or [[Trigger|triggers]] in Excalibur.

This is a great way to globally simulate effects like gravity.

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticbodiesCanSleepByDefault

bodiesCanSleepByDefault: boolean = false

By default bodies do not sleep

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticboundsPadding

boundsPadding: number = 5

Pad RigidBody BoundingBox by a constant amount

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticbroadphaseStrategy

broadphaseStrategy: DynamicAABBTree = BroadphaseStrategy.DynamicAABBTree

Gets or sets the broadphase pair identification strategy.

The default strategy is [[BroadphaseStrategy.DynamicAABBTree]] which uses a binary tree of axis-aligned bounding boxes to identify potential collision pairs which is O(nlog(n)) faster.

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticcheckForFastBodies

checkForFastBodies: boolean = true

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.

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticcollisionResolutionStrategy

collisionResolutionStrategy: SolverStrategy = SolverStrategy.Arcade

Gets or sets the global collision resolution strategy (narrowphase).

The default is [[SolverStrategy.Arcade]] which performs simple axis aligned arcade style physics.

More advanced rigid body physics are enabled by setting [[SolverStrategy.Realistic]] which allows for complicated simulated physical interactions.

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticdefaultMass

defaultMass: number = 10

The default mass to use if none is specified

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticdisableMinimumSpeedForFastBody

disableMinimumSpeedForFastBody: boolean = false

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

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticdynamicTreeVelocityMultiplier

dynamicTreeVelocityMultiplier: number = 2

Factor to add to the RigidBody BoundingBox, bounding box (dimensions += vel * dynamicTreeVelocityMultiplier);

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticenabled

enabled: boolean = true

Globally switches all Excalibur physics behavior on or off.

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticintegrator

integrator: Euler = Integrator.Euler

Gets or sets the position and velocity positional integrator, currently only Euler is supported.

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticpositionIterations

positionIterations: number = 3

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

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticsleepBias

sleepBias: number = 0.9
@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticsleepEpsilon

sleepEpsilon: number = 0.07
@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticslop

slop: number = 1

Amount of overlap to tolerate in pixels

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticsteeringFactor

steeringFactor: number = 0.2

Amount of positional overlap correction to apply each position iteration of the solver O - meaning no correction, 1 - meaning correct all overlap

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticsurfaceEpsilon

surfaceEpsilon: number = 0.1

Surface epsilon is used to help deal with surface penetration

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticvelocityIterations

velocityIterations: number = 8

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

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticwakeThreshold

wakeThreshold: number = ...
@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

publicstaticwarmStart

warmStart: boolean = true

Warm start set to true re-uses impulses from previous frames back in the solver

@deprecated

Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30

Accessors

publicstaticgravity

  • @deprecated

    Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30


    Returns Vector

  • Parameters

    Returns void

Methods

publicstaticuseArcadePhysics

  • useArcadePhysics(): void
  • Configures Excalibur to use "arcade" physics. Arcade physics which performs simple axis aligned arcade style physics.

    @deprecated

    Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30


    Returns void

publicstaticuseRealisticPhysics

  • useRealisticPhysics(): void
  • Configures Excalibur to use rigid body physics. Rigid body physics allows for complicated simulated physical interactions.

    @deprecated

    Use engine args to configure Physics new ex.Engine({physics: {...}}), will be removed in v0.30


    Returns void