jetlag2d
    Preparing search index...

    Interface PhysicsCfg

    PhysicsCfg describes provides advanced, but optional, ways of altering the physical behavior of rigid bodies when they are being constructed. Each field's own doc comment is the single source of truth for that option; CircleBody/BoxBody/PolygonBody's constructors just link here via {@link PhysicsCfg} instead of re-describing every field.

    interface PhysicsCfg {
        collisionsEnabled?: boolean;
        density?: number;
        disableRotation?: boolean;
        dynamic?: boolean;
        elasticity?: number;
        friction?: number;
        kinematic?: boolean;
        passThroughId?: number[];
        rotateByDirection?: boolean;
        rotationSpeed?: number;
        scene?: Scene<AdvancedCollisionService | BasicCollisionService>;
        singleRigidSide?: DIRECTION;
        stickyDelay?: number;
        stickySides?: DIRECTION[];
        stickySpeedLimit?: number;
    }
    Index
    collisionsEnabled?: boolean

    Do collisions happen, or do other bodies glide through this?

    density?: number

    The density of the body

    disableRotation?: boolean

    Should rotation be disabled?

    dynamic?: boolean

    Should the body be forced to be dynamic?

    elasticity?: number

    The elasticity of the body

    friction?: number

    The friction of the body

    kinematic?: boolean

    Should the body be forced to be kinematic?

    passThroughId?: number[]

    Entities with a matching nonzero Id don't collide with each other

    rotateByDirection?: boolean

    Should the actor rotate based on its direction of movement?

    rotationSpeed?: number

    The speed at which to rotate, in rotations per second

    The scene where this body should be made (defaults to stage.world)

    singleRigidSide?: DIRECTION

    Are collisions only valid from one direction? Expressed as the zone (see relativeZone) something must be in to collide with this body, e.g. DIRECTION.N for "solid only when approached from above."

    stickyDelay?: number

    Delay (milliseconds) after something stops sticking, before it can stick again

    stickySides?: DIRECTION[]

    Which sides of the body are sticky, if any? Expressed as the zone (see relativeZone) an actor is in when touching that side, e.g. DIRECTION.N for "stuff that touches my top."

    stickySpeedLimit?: number

    Fastest speed (meters per second) at which something can move, relative to this body, and still stick to it. Something that is moving faster (like a player who is walking across a sticky platform) doesn't stick until it slows down. Defaults to 0.5.