A chain shape is a free form sequence of line segments. The chain has
two-sided collision, so you can use inside and outside collision.
Therefore, you may use any winding order. Connectivity information is used
to create smooth collisions. WARNING: The chain will not collide properly if
there are self-intersections.
Functions used for computing contact points, distance queries, and TOI
queries. Collision methods are non-static for pooling speed, retrieve a
collision object from the SingletonPool.
Should not be finalructed.
The class manages contact between two shapes. A contact exists for each
overlapping AABB in the broad-phase (except if filtered). Therefore a
contact object may exist that has no contact points.
Contact impulses for reporting. Impulses are used instead of forces because
sub-step forces may approach infinity for rigid body collisions. These match
up one-to-one with the contact points in b2Manifold.
Implement this class to get contact information. You can use these results
for things like sounds and game logic. You can also get contact results by
traversing the contact lists after the time step. However, you might miss
some contacts because continuous physics leads to sub-stepping.
Additionally you may receive multiple callbacks for the same contact in a
single time step.
You should strive to make your callbacks efficient because there may be
many callbacks per time step.
Warning: You cannot create/destroy Forge2D entities inside these callbacks.
The broad-phase is used for computing pairs and performing volume queries
and ray casts. This broad-phase does not persist pairs. Instead, this
reports potentially new pairs. It is up to the client to consume the new
pairs and to track subsequent overlap.
Joints and fixtures are destroyed when their associated
body is destroyed. Implement this listener so that you
may remove references to these joints and shapes.
Distance joint definition. This requires defining an anchor point on both
bodies and the non-zero length of the distance joint. The definition uses
local anchor points so that the initial configuration can violate the
constraint slightly. This helps when saving and loading a game.
A dynamic tree arranges data in a binary tree to accelerate queries such as
volume queries and ray casts. Leaves are proxies with an AABB. In the tree
we expand the proxy AABB by _fatAABBFactor so that the proxy AABB is bigger
than the client object. This allows the client object to move by small
amounts without triggering a tree update.
A line segment (edge) shape. These can be connected in chains or loops to
other edge shapes. The connectivity information is used to ensure correct
contact normals.
A fixture is used to attach a Shape to a Body for collision detection. A
fixture inherits its transform from its parent. Fixtures hold additional
non-geometric data such as friction, collision filters, etc. Fixtures are
created via body.createFixture.
A gear joint is used to connect two joints together. Either joint can be a
revolute or prismatic joint. You specify a gear ratio to bind the motion
together: coordinate1 + ratio * coordinate2 =
constant The ratio can be negative or positive. If one joint is a revolute
joint and the other joint is a prismatic joint, then the ratio will have
units of length or units of 1/length.
Gear joint definition. This definition requires two existing revolute or
prismatic joints (any combination will work).
The provided joints must attach a dynamic body to a static body.
A manifold point is a contact point belonging to a contact
manifold. It holds details related to the geometry and dynamics
of the contact points.
The local point usage depends on the manifold type:
A motor joint is used to control the relative motion between two bodies.
A typical usage is to control the movement of a dynamic body with respect to
the ground.
A mouse joint is used to make a point on a body track a specified world
point. This a soft constraint with a maximum force. This allows the
constraint to stretch and without applying huge forces.
NOTE: this joint is not documented in the manual because it was developed to
be used in the testbed. If you want to learn how to use the mouse joint,
look at the testbed.
A convex polygon shape. Polygons have a maximum number of vertices equal to
_maxPolygonVertices.
In most cases you should not need many vertices for a convex polygon.
A prismatic joint. This joint provides one degree of freedom: translation
along an axis fixed in bodyA. Relative rotation is prevented. You can use a
joint limit to restrict the range of motion and a joint motor to drive the
motion or to model joint friction.
Prismatic joint definition. This requires defining a line of motion using an
axis and an anchor point. The definition uses local anchor points and a
local axis so that the initial configuration can violate the constraint
slightly. The joint translation is zero when the local anchor points
coincide in world space. Using local anchors and a local axis helps when
saving and loading a game.
The pulley joint is connected to two bodies and two fixed ground points.
The pulley supports a ratio such that: length1 + ratio * length2 <= constant
Yes, the force transmitted is scaled by the ratio.
Warning: the pulley joint can get a bit squirrelly by itself. They often
work better when combined with prismatic joints. You should also cover the
anchor points with static shapes to prevent one side from going to zero
length.
A revolute joint constrains two bodies to share a common point while they
are free to rotate about the point. The relative rotation about the shared
point is the joint angle. You can limit the relative rotation with a joint
limit that specifies a lower and upper angle. You can use a motor to drive
the relative rotation about the shared point. A maximum motor torque is
provided so that infinite forces are not generated.
Revolute joint definition. This requires defining an anchor point where the
bodies are joined. The definition uses local anchor points so that the
initial configuration can violate the constraint slightly.
You also need to specify the initial relative angle for joint limits. This
helps when saving and loading a game. The local anchor points are measured
from the body's origin rather than the center of mass because:
A rope joint enforces a maximum distance between two points on two bodies.
It has no other effect.
Warning: if you attempt to change the maximum length during the simulation
you will get some non-physical behavior. A model that would allow you to
dynamically modify the length would have some sponginess, so I chose not to
implement it that way. See DistanceJoint if you want to dynamically control
length.
A shape is used for collision detection. You can create a shape however you
like. Shapes used for simulation in World are created automatically when a
Fixture is created. Shapes may encapsulate a one or more child shapes.
This describes the motion of a body/shape for TOI computation. Shapes are
defined with respect to the body origin, which may not coincide with the
center of mass. However, to support dynamics we must interpolate the center
of mass position.
A wheel joint. This joint provides two degrees of freedom: translation along
an axis fixed in bodyA and rotation in the plane. You can use a joint limit
to restrict the range of motion and a joint motor to drive the rotation or
to model rotational friction. This joint is designed for vehicle
suspensions.
Wheel joint definition. This requires defining a line of motion using an
axis and an anchor point.
The definition uses local anchor points and a local axis so that the initial
configuration can violate the constraint slightly. The joint translation is
zero when the local anchor points coincide in world space. Using local
anchors and a local axis helps when saving and loading a game.
The world class manages all physics entities, dynamic simulation, and
asynchronous queries. The world also contains efficient memory management
facilities.
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.
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.
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.
NOTE: If you change any of these values, do make sure that you know what you
are doing. Don't change these because your bodies are moving to slowly,
then you have done something else that is wrong, like setting the scale too
low.
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.