ChainShape class

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.

Inheritance

Constructors

ChainShape()

Properties

childCount int
Get the number of child primitives
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
nextVertex Vector2
Establish connectivity to a vertex that follows the last vertex. Don't call this for loops.
no getter
prevVertex Vector2
Establish connectivity to a vertex that precedes the first vertex. Don't call this for loops.
no getter
radius double
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shapeType ShapeType
finalinherited
vertexCount int
no setter
vertices List<Vector2>
Do not modify directly
final

Methods

childEdge(int index) EdgeShape
Get a child edge.
clear() → void
clone() Shape
override
computeAABB(AABB aabb, Transform xf, int childIndex) → void
Given a transform, compute the associated axis aligned bounding box for a child shape.
override
computeDistanceToOut(Transform xf, Vector2 p, int childIndex, Vector2 normalOut) double
Compute the distance from the current shape to the specified point. This only works for convex shapes.
override
computeMass(MassData massData, double density) → void
Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin. density should be in kilograms per meter squared.
override
createChain(List<Vector2> vertices) → void
Create a chain with isolated end vertices.
createLoop(List<Vector2> vertices) → void
Create a loop. This automatically adjusts connectivity.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
raycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex) bool
Cast a ray against a child shape.
override
testPoint(Transform xf, Vector2 p) bool
Test a point for containment in this shape. This only works for convex shapes.
override
toString() String
A string representation of this object.
inherited
vertex(int index) Vector2
Returns the vertex at the given position (index).

Operators

operator ==(Object other) bool
The equality operator.
inherited