Options
All
  • Public
  • Public/Protected
  • All
Menu

Controls Box2D global settings.

Hierarchy

  • b2Settings

Index

Constructors

Properties

USHRT_MAX: number

Maximum unsigned short value.

VERSION: string

The current version of Box2D.

b2_aabbExtension: number

This is used to fatten AABBs in the dynamic tree. This allows proxies to move by a small amount without triggering a tree adjustment. This is in meters.

b2_aabbMultiplier: number

This is used to fatten AABBs in the dynamic tree. This is used to predict the future position based on the current displacement. This is a dimensionless multiplier.

b2_angularSleepTolerance: number

A body cannot sleep if its angular velocity is above this tolerance.

b2_angularSlop: number

A small angle used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.

b2_contactBaumgarte: number

This scale factor controls how fast overlap is resolved. Ideally this would be 1 so that overlap is removed in one time step. However using values close to 1 often lead to overshoot.

b2_linearSleepTolerance: number

A body cannot sleep if its linear velocity is above this tolerance.

b2_linearSlop: number

A small length used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.

b2_maxAngularCorrection: number

The maximum angular position correction used when solving constraints. This helps to prevent overshoot.

b2_maxLinearCorrection: number

The maximum linear position correction used when solving constraints. This helps to prevent overshoot.

b2_maxManifoldPoints: number

Number of manifold points in a b2Manifold. This should NEVER change.

b2_maxRotation: number

The maximum angular velocity of a body. This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this.

b2_maxRotationSquared: number

b2_maxRotation squared

b2_maxTOIContactsPerIsland: number

Maximum number of contacts to be handled to solve a TOI island.

b2_maxTOIJointsPerIsland: number

Maximum number of joints to be handled to solve a TOI island.

b2_maxTranslation: number

The maximum linear velocity of a body. This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this.

b2_maxTranslationSquared: number

b2_maxTranslation squared

b2_pi: number

3.141592653589793

b2_polygonRadius: number

The radius of the polygon/edge shape skin. This should not be modified. Making this smaller means polygons will have and insufficient for continuous collision. Making it larger may create artifacts for vertex collision.

b2_timeToSleep: number

The time that a body must be still before it will go to sleep.

b2_toiSlop: number

Continuous collision detection (CCD) works with core, shrunken shapes. This is the amount by which shapes are automatically shrunk to work with CCD. This must be larger than b2_linearSlop.

see

also b2_linearSlop

b2_velocityThreshold: number

A velocity threshold for elastic collisions. Any collision with a relative linear velocity below this threshold will be treated as inelastic.

Methods

  • b2Assert(a: boolean): void
  • b2Assert is used internally to handle assertions. By default, calls are commented out to save performance, so they serve more as documentation than anything else.

    Parameters

    • a: boolean

      Asset an expression is true.

    Returns void

  • b2MixFriction(friction1: number, friction2: number): number
  • Friction mixing law. Feel free to customize this. Friction values are usually set between 0 and 1. (0 = no friction, 1 = high friction) By default this is return Math.sqrt(friction1, friction2);

    Parameters

    • friction1: number

      Friction 1 to mix.

    • friction2: number

      Friction 2 to mix.

    Returns number

    The two frictions mixed as one value.

  • b2MixRestitution(restitution1: number, restitution2: number): number
  • Restitution mixing law. Feel free to customize this. Restitution is used to make objects bounce. Restitution values are usually set between 0 and 1. (0 = no bounce (inelastic), 1 = perfect bounce (perfectly elastic)) By default this is return Math.Max(restitution1, restitution2);

    Parameters

    • restitution1: number

      Restitution 1 to mix.

    • restitution2: number

      Restitution 2 to mix.

    Returns number

    The two restitutions mixed as one value.

Generated using TypeDoc