A solid convex polygon. It is assumed that the interior of the polygon is to the left of each edge. Polygons have a maximum number of vertices equal to B2_MAX_POLYGON_VERTICES. In most cases you should not need many vertices for a convex polygon. Warning: DO NOT fill this out manually, instead use a helper function like MakePolygon or MakeBox.
More...
|
| Polygon (ReadOnlySpan< Vec2 > points, float radius=0f) |
| Construct a polygon shape with a set of vertices and an optional radius.
|
|
static Polygon | MakePolygon (in Hull hull, float radius) |
| Make a convex polygon from a convex hull. This will assert if the hull is not valid.
|
|
static Polygon | MakeOffsetPolygon (in Hull hull, Vec2 position, Rotation rotation) |
| Make an offset convex polygon from a convex hull. This will assert if the hull is not valid.
|
|
static Polygon | MakeOffsetRoundedPolygon (in Hull hull, Vec2 position, Rotation rotation, float radius) |
| Make an offset convex polygon from a convex hull. This will assert if the hull is not valid.
|
|
static Polygon | MakeSquare (float halfWidth) |
| Make a square polygon, bypassing the need for a convex hull.
|
|
static Polygon | MakeBox (float halfWidth, float halfHeight) |
| Make a box (rectangle) polygon, bypassing the need for a convex hull.
|
|
static Polygon | MakeRoundedBox (float halfWidth, float halfHeight, float radius) |
| Make a rounded box, bypassing the need for a convex hull.
|
|
static Polygon | MakeOffsetBox (float halfWidth, float halfHeight, Vec2 center, Rotation rotation) |
| Make an offset box, bypassing the need for a convex hull.
|
|
static Polygon | MakeOffsetRoundedBox (float halfWidth, float halfHeight, Vec2 center, Rotation rotation, float radius) |
| Make an offset rounded box, bypassing the need for a convex hull.
|
|
static Polygon | TransformPolygon (Transform transform, in Polygon polygon) |
| Transform a polygon. This is useful for transferring a shape from one body to another.
|
|
MassData | ComputeMass (float density) |
| Compute mass properties of this polygon.
|
|
AABB | ComputeAABB (in Transform transform) |
| Compute the bounding box of this transformed polygon.
|
|
bool | TestPoint (in Vec2 point) |
| Test this point for overlap with a convex polygon in local space.
|
|
CastOutput | RayCast (in RayCastInput input) |
| Ray cast versus this polygon shape in local space. Initial overlap is treated as a miss.
|
|
CastOutput | ShapeCast (in ShapeCastInput input) |
| Shape cast versus this convex polygon. Initial overlap is treated as a miss.
|
|
|
static Polygon | MakePolygon (ReadOnlySpan< Vec2 > points, float radius) |
| Make a convex polygon from a set of points. This will create a hull and assert if it is not valid.
|
|
static Polygon | MakeOffsetPolygon (Span< Vec2 > points, Vec2 position, Rotation rotation) |
| Make an offset convex polygon from a set of points. This will create a hull and assert if it is not valid.
|
|
static Polygon | MakeOffsetRoundedPolygon (Span< Vec2 > points, Vec2 position, Rotation rotation, float radius) |
| Make an offset convex polygon from a set of points. This will create a hull and assert if it is not valid.
|
|
A solid convex polygon. It is assumed that the interior of the polygon is to the left of each edge. Polygons have a maximum number of vertices equal to B2_MAX_POLYGON_VERTICES. In most cases you should not need many vertices for a convex polygon. Warning: DO NOT fill this out manually, instead use a helper function like MakePolygon or MakeBox.