Create a capsule with the given total width and height.
Total width (tip to tip). Must be >= height.
Total height (diameter of the end-caps). Must be > 0.
OptionallocalCOM: Vec2Local centre offset (defaults to origin).
Optionalmaterial: MaterialMaterial to assign (uses default if omitted).
Optionalfilter: InteractionFilterInteractionFilter to assign (uses default if omitted).
Angular drag coefficient for this shape.
Cross-sectional area of this shape.
World-space AABB of this shape (updated each step).
Cast to Body — returns the Body wrapper if this is a Body, else null.
Cast to Capsule, or null if this is not a capsule.
Cast to Circle, or null if this is not a circle.
Cast to Compound — returns the Compound wrapper if this is a Compound, else null.
Cast to Polygon, or null if this is not a polygon.
Cast to Shape — returns the Shape wrapper if this is a Shape, else null.
Set of callback types registered on this shape for event dispatch.
The InteractionFilter controlling which shapes interact with this one.
If true, this shape participates in fluid interaction.
Fluid simulation properties for this shape. Auto-created on first access.
The interaction group this interactor belongs to.
Half the spine length. Total width = 2 * (halfLength + radius).
Total height of the capsule (diameter of end-caps).
Unique numeric identifier for this interactor.
Contribution to moment of inertia (about local centroid, unit density).
The capsule's end-cap radius (half the height). Must be > 0.
If true, this shape acts as a sensor (no physical response, only callbacks).
The shape type: CIRCLE or POLYGON.
User-defined data storage object.
Total width of the capsule (tip to tip).
World-space centre of mass of this shape (read-only, lazy-computed).
Return true if the given world-space point lies inside this shape. Requires the shape to be attached to a Body.
The world-space point to test.
True if the point is inside this shape.
Create a deep copy of this shape with the same type, geometry, material, and filter.
A new Shape instance independent of this one.
Returns true if this interactor is a Body.
Returns true if this is a Capsule shape.
Returns true if this is a Circle shape.
Returns true if this interactor is a Compound.
Returns true if this is a Polygon shape.
Returns true if this interactor is a Shape.
Rotate the shape's local vertices by angle radians.
Rotation in radians.
this for chaining.
Scale the shape's local geometry. Circles require uniform scaling.
Horizontal scale factor (must be non-zero).
Vertical scale factor (must be non-zero).
this for chaining.
Apply a Mat23 affine transform to the shape's local geometry.
The transformation matrix (must be non-singular; Circles require equiorthogonal).
this for chaining.
A capsule physics shape — a line segment with a radius (stadium geometry).
Geometrically equivalent to a rectangle with two semicircular end-caps. The spine runs along the local X-axis through localCOM.
Example