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 double 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 double LINEAR_SLEEP_TOLERANCE = 0.01;

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

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

 static const double TIME_TO_SLEEP = 0.5;

 static const int TREE_REBALANCE_STEPS = 4;

 static const int MAX_INTEGER = 2147483647;

 static const double SMALL_NUMBER = .000000000001;
 static const double 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 double 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 double POLYGON_RADIUS = 2.0 * LINEAR_SLOP;

 static const int 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 double 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 double BOUNDING_BOX_MULTIPLIER = 2.0;

 /**
  * 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 double 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 double MAX_TRANSLATION = 2.0;
 static const double 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 double MAX_ROTATION = 0.5 * Math.PI;
 static const double 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 double ANGULAR_SLOP = (2.0 / 180.0 * Math.PI);

 /**
  * The maximum angular position correction used when solving constraints.
  * This helps to prevent overshoot.
  */
 static const double 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 double mixFriction(double friction1, double friction2) {
   return Math.sqrt(friction1 * friction2);
 }

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

Static Properties

const double ANGULAR_SLEEP_TOLERANCE #

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

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

const double 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 double ANGULAR_SLOP = (2.0 / 180.0 * Math.PI)

const double BIG_NUMBER #

static const double BIG_NUMBER = 99999999999999.0

const double 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 double BOUNDING_BOX_EXTENSION = .1

const double 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 double BOUNDING_BOX_MULTIPLIER = 2.0

const double 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 double 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 double EPSILON #

A "close to Zero" num epsilon value for use

static const double EPSILON = .0000001192

const double LINEAR_SLEEP_TOLERANCE #

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

static const double LINEAR_SLEEP_TOLERANCE = 0.01

const double 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 double LINEAR_SLOP = 0.005

const double MAX_ANGULAR_CORRECTION #

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

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

const int MAX_INTEGER #

static const int MAX_INTEGER = 2147483647

const double MAX_LINEAR_CORRECTION #

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

static const double 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 double 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 double MAX_ROTATION = 0.5 * Math.PI

const double MAX_ROTATION_SQUARED #

static const double 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 double 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 double MAX_TRANSLATION = 2.0

const double MAX_TRANSLATION_SQUARED #

static const double MAX_TRANSLATION_SQUARED = MAX_TRANSLATION * MAX_TRANSLATION

const double 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 double POLYGON_RADIUS = 2.0 * LINEAR_SLOP

const double SMALL_NUMBER #

static const double SMALL_NUMBER = .000000000001

const double TIME_TO_SLEEP #

static const double TIME_TO_SLEEP = 0.5

const int TREE_REBALANCE_STEPS #

static const int TREE_REBALANCE_STEPS = 4

const int VELOCITY_THRESHOLD #

static const int VELOCITY_THRESHOLD = 1

Static Methods

double mixFriction(double friction1, double friction2) #

Friction mixing law.

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

double mixRestitution(double restitution1, double restitution2) #

Restitution mixing law.

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