PhysicsConfig
Index
Properties
optionalarcade
Type declaration
optionalcontactSolveBias?: ContactSolveBias
Hints the ArcadeSolver to preferentially solve certain contact directions first.
Options:
- Solve ContactSolveBias.VerticalFirst which will do vertical contact resolution first (useful for platformers with up/down gravity)
- Solve ContactSolveBias.HorizontalFirst which will do horizontal contact resolution first (useful for games with left/right forces)
- By default ContactSolveBias.None which sorts by distance
optionalbodies
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
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
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
optionalenabled
Excalibur physics simulation is enabled
optionalgravity
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
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
- SolverStrategy.Arcade is suitable for games where you might be doing platforming or top down movement.
- SolverStrategy.Realistic is where you need objects to bounce off each other and respond like real world objects.
Default is Arcade
optionalsparseHashGrid
optionalspatialPartition
Configure the spatial data structure for locating pairs and raycasts
optionalsubstep
Configure physics sub-stepping, this can increase simulation fidelity by doing smaller physics steps
Default is 1 step
Configure the ArcadeSolver