Convex polygon. The vertices must be in CCW order for a right-handed coordinate system with the z-axis coming out of the screen.
Creates a new b2Shape.
Creates a b2PolygonShape from a vertices list. This assumes the vertices define a convex polygon. It is assumed that the exterior is the the right of each edge.
List of vertices to create the polygon shape from.
Number of vertices in the shape, default value is 0 and in the box2dweb.js code it is ignored.
Convex polygon shape.
Build vertices to represent an axis-aligned box.
The half-width.
The half-height.
Box polygon shape.
Creates a single edge from two vertices.
Edge polygon shape.
Build vertices to represent an oriented box.
The half-width.
The half-height.
The center of the box in local coordinates, default is null (no center?)
The rotation of the box in local coordinates, default is 0.0.
Oriented box shape.
This assumes the vertices define a convex polygon. It is assumed that the exterior is the the right of each edge.
List of vertices to create the polygon shape from.
The number of vertices, default is 0 and in the box2dweb.js code it is ignored.
Convex polygon shape.
Given a transform, compute the associated axis aligned bounding box for this shape.
Calculated AABB, this argument is out
.
Transform to calculate the AABB.
Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.
Calculate the mass, this argument is out
.
Compute the volume and centroid of this shape intersected with a half plane
The surface normal.
The surface offset along the normal.
The shape transform.
The centroid, this argument is out
.
number
Clone the shape.
Get the edge normal vectors. There is one for each vertex.
b2Vec2[]
List of edge normal vectors for each vertex.
Get the supporting vertex index in the given direction.
Direction to look.
number
Vertex index supporting the direction.
Get the supporting vertex in the given direction.
Direciton to look.
Vertex supporting the direction.
Get the type of this shape. You can use this to down cast to the concrete shape.
number
Get the vertex count.
number
Vertex count.
Get the vertices in local coordinates.
b2Vec2[]
List of the vertices in local coordinates.
Cast a ray against this shape.
Ray cast results, this argument is out
.
Ray cast input parameters.
The transform to be applied to the shape.
boolean
True if the ray hits the shape, otherwise false.
Set the shape values from another shape.
The other shape to copy values from.
Copy vertices. This assumes the vertices define a convex polygon. It is assumed that the exterior is the the right of each edge.
List of vertices to create the polygon shape from.
Number of vertices in the shape, default value is 0 and in the box2dweb.js code it is ignored.
Build vertices to represent an axis-aligned box.
The half-width.
The half-height.
Creates a single edge from two vertices.
Build vertices to represent an oriented box.
The half-width.
The half-height.
The center of the box in local coordinates, default is null (no center?)
The rotation of the box in local coordinates, default is 0.0.
This assumes the vertices define a convex polygon. It is assumed that the exterior is the the right of each edge.
List of vertices to create the polygon shape from.
The number of vertices, default is 0 and in the box2dweb.js code it is ignored.
Test a point for containment in this shape. This only works for convex shapes.
Shape world transform.
Point to test against, in world coordinates.
boolean
True if the point is in this shape, otherwise false.