Skip to main content

BodyComponentOptions

Index

Properties

optionalconfig

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

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 - The weighted average to apply to the current frame body motion over one second

    let bias = Math.pos(sleepBias, durationSeconds);
    let motion = bias * previousAverageMotion + (1 - bias) * currentFrameMotion;

    Default 0.5

  • optionalsleepEpsilon?: number

    Sleep epsilon - (small number) this is the amount of massless kinetic energy a body needs to be below to fall asleep

    Default 0.07

  • optionalsleepTimeThreshold?: number

    Amount of time that bodies (in contact islands) need to be below the sleepEpsilon

    Default 1000ms

  • optionalwakeThreshold?: number

    Wake Threshold - the amount of "motion" or massless kinetic energy need to wake a body from sleep

    Default 0.07 * 3;

optionalgroup

optionaltype

optionaluseGravity

useGravity?: boolean
Page Options