Dart Documentationbox2dSettings

Settings class

class Settings {
 /** Size that pool stacks are initialized to. */
 static const int CONTACT_STACK_INIT_SIZE = 10;

 /** A "close to Zero" num epsilon value for use */
 static const num EPSILON = .0000001192;

 /**
  * Maximum number of contacts to be handled to solve a TimeOfImpact island.
  */
 static const int MAX_TIME_OF_IMPACT_CONTACTS = 32;

 /**
  * A body cannot sleep if its linear velocity is above this tolerance.
  */
 static const num LINEAR_SLEEP_TOLERANCE = 0.01;

 /**
  * The maximum linear position correction used when solving constraints.
  * This helps to prevent overshoot.
  */
 static const num MAX_LINEAR_CORRECTION = 0.2;

 /**
  * A body cannot sleep if its angular velocity is above this tolerance.
  */
 static const num ANGULAR_SLEEP_TOLERANCE = 2.0 / 180.0 * Math.PI;

 static const num TIME_TO_SLEEP = 0.5;

 static const int TREE_REBALANCE_STEPS = 4;

 static const int MAX_INTEGER = 2147483647;

 static const num SMALL_NUMBER = .000000000001;
 static const num BIG_NUMBER = 99999999999999.0;

 /**
  * A small length used as a collision and constant tolerance. Usually it
  * is chosen to be numerically significant, but visually insignificant.
  */
 static const num LINEAR_SLOP = 0.005;

 /**
  * 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.
  */
 static const num POLYGON_RADIUS = 2.0 * LINEAR_SLOP;

 static const num VELOCITY_THRESHOLD = 1;

 /**
  * Fattens bounding boxes in the dynamic tree by this amount. Allows proxies
  * to move by small amounts without needing to adjust the tree. This value is
  * in meters.
  */
 static const num BOUNDING_BOX_EXTENSION = .1;

 /**
  * 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.
  */
 static const num BOUNDING_BOX_MULTIPLIER = 2;

 /**
  * 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.
  */
 static const num CONTACT_BAUMGARTE = 0.2;

 /**
  * 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.
  */
 static const num MAX_TRANSLATION = 2.0;
 static const num MAX_TRANSLATION_SQUARED = MAX_TRANSLATION * MAX_TRANSLATION;

 /**
  * 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.
  */
 static const num MAX_ROTATION = 0.5 * Math.PI;
 static const num MAX_ROTATION_SQUARED = MAX_ROTATION * MAX_ROTATION;

 /**
  * The maximum number of contact points between two convex shapes.
  */
 static const int MAX_MANIFOLD_POINTS = 2;

 /**
  * A small angle used as a collision and constraint tolerance. Usually it is
  * chosen to be numerically significant, but visually insignificant.
  */
 static const num ANGULAR_SLOP = (2.0 / 180.0 * Math.PI);

 /**
  * The maximum angular position correction used when solving constraints.
  * This helps to prevent overshoot.
  */
 static const num MAX_ANGULAR_CORRECTION = (8.0 / 180.0 * Math.PI);

 /**
  * The maximum number of vertices on a convex polygon.
  */
 static const int MAX_POLYGON_VERTICES = 8;

 /**
  * Friction mixing law.
  */
 static num mixFriction(num friction1, num friction2) {
   return Math.sqrt(friction1 * friction2);
 }

 /**
  * Restitution mixing law.
  */
 static num mixRestitution(num restitution1, num restitution2) {
   return restitution1 > restitution2 ? restitution1 : restitution2;
 }
}

Static Properties

const num ANGULAR_SLEEP_TOLERANCE #

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

static const num ANGULAR_SLEEP_TOLERANCE = 2.0 / 180.0 * Math.PI

const num ANGULAR_SLOP #

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

static const num ANGULAR_SLOP = (2.0 / 180.0 * Math.PI)

const num BIG_NUMBER #

static const num BIG_NUMBER = 99999999999999.0

const num BOUNDING_BOX_EXTENSION #

Fattens bounding boxes in the dynamic tree by this amount. Allows proxies to move by small amounts without needing to adjust the tree. This value is in meters.

static const num BOUNDING_BOX_EXTENSION = .1

const num BOUNDING_BOX_MULTIPLIER #

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.

static const num BOUNDING_BOX_MULTIPLIER = 2

const num CONTACT_BAUMGARTE #

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.

static const num CONTACT_BAUMGARTE = 0.2

const int CONTACT_STACK_INIT_SIZE #

Size that pool stacks are initialized to.

static const int CONTACT_STACK_INIT_SIZE = 10

const num EPSILON #

A "close to Zero" num epsilon value for use

static const num EPSILON = .0000001192

const num LINEAR_SLEEP_TOLERANCE #

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

static const num LINEAR_SLEEP_TOLERANCE = 0.01

const num LINEAR_SLOP #

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

static const num LINEAR_SLOP = 0.005

const num MAX_ANGULAR_CORRECTION #

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

static const num MAX_ANGULAR_CORRECTION = (8.0 / 180.0 * Math.PI)

const int MAX_INTEGER #

static const int MAX_INTEGER = 2147483647

const num MAX_LINEAR_CORRECTION #

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

static const num MAX_LINEAR_CORRECTION = 0.2

const int MAX_MANIFOLD_POINTS #

The maximum number of contact points between two convex shapes.

static const int MAX_MANIFOLD_POINTS = 2

const int MAX_POLYGON_VERTICES #

The maximum number of vertices on a convex polygon.

static const int MAX_POLYGON_VERTICES = 8

const num MAX_ROTATION #

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.

static const num MAX_ROTATION = 0.5 * Math.PI

const num MAX_ROTATION_SQUARED #

static const num MAX_ROTATION_SQUARED = MAX_ROTATION * MAX_ROTATION

const int MAX_TIME_OF_IMPACT_CONTACTS #

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

static const int MAX_TIME_OF_IMPACT_CONTACTS = 32

const num MAX_TRANSLATION #

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.

static const num MAX_TRANSLATION = 2.0

const num MAX_TRANSLATION_SQUARED #

static const num MAX_TRANSLATION_SQUARED = MAX_TRANSLATION * MAX_TRANSLATION

const num POLYGON_RADIUS #

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.

static const num POLYGON_RADIUS = 2.0 * LINEAR_SLOP

const num SMALL_NUMBER #

static const num SMALL_NUMBER = .000000000001

const num TIME_TO_SLEEP #

static const num TIME_TO_SLEEP = 0.5

const int TREE_REBALANCE_STEPS #

static const int TREE_REBALANCE_STEPS = 4

const num VELOCITY_THRESHOLD #

static const num VELOCITY_THRESHOLD = 1

Static Methods

num mixFriction(num friction1, num friction2) #

Friction mixing law.

static num mixFriction(num friction1, num friction2) {
 return Math.sqrt(friction1 * friction2);
}

num mixRestitution(num restitution1, num restitution2) #

Restitution mixing law.

static num mixRestitution(num restitution1, num restitution2) {
 return restitution1 > restitution2 ? restitution1 : restitution2;
}