Chain shapes allow you to create a polygonal chain that is resistant to ghost collisions. More...
Data Structures | |
| struct | b2ChainDef |
| Used to create a chain of line segments. More... | |
Functions | |
| b2ChainId | b2CreateChain (b2BodyId bodyId, const b2ChainDef *def) |
| Create a chain shape. | |
| void | b2DestroyChain (b2ChainId chainId) |
| Destroy a chain shape. | |
| b2WorldId | b2Chain_GetWorld (b2ChainId chainId) |
| Get the world that owns this chain shape. | |
| int | b2Chain_GetSegmentCount (b2ChainId chainId) |
| Get the number of segments on this chain. | |
| int | b2Chain_GetSegments (b2ChainId chainId, b2ShapeId *segmentArray, int capacity) |
| Fill a user array with chain segment shape ids up to the specified capacity. | |
| void | b2Chain_SetAllSurfaceMaterials (b2ChainId chainId, const b2SurfaceMaterial *material) |
| Set the chain material on all segments. | |
| void | b2Chain_SetSurfaceMaterial (b2ChainId chainId, const b2SurfaceMaterial *material, int segmentIndex) |
| Set a chain material by segment index. | |
| b2SurfaceMaterial | b2Chain_GetSurfaceMaterial (b2ChainId chainId, int segmentIndex) |
| Get a chain material by segment index. | |
| bool | b2Chain_IsValid (b2ChainId id) |
| Chain identifier validation. Provides validation for up to 64K allocations. | |
| b2ChainDef | b2DefaultChainDef (void) |
| Use this to initialize your chain definition. | |
Chain shapes allow you to create a polygonal chain that is resistant to ghost collisions.
| struct b2ChainDef |
Used to create a chain of line segments.
This is designed to eliminate ghost collisions with some limitations.
| Data Fields | ||
|---|---|---|
| bool | enableSensorEvents | Enable sensors to detect this chain. False by default. |
| b2Filter | filter | Contact filtering data. |
| b2Vec2 | ghost1 |
Leading ghost point for an open chain. Distance from first point must be greater than B2_LINEAR_SLOP. Ignored for loops. |
| b2Vec2 | ghost2 |
Ending ghost point for an open chain. Distance from last point must be greater than B2_LINEAR_SLOP. Ignored for loops. |
| int | internalValue | Used internally to detect a valid definition. DO NOT SET. |
| bool | isLoop | Indicates a closed chain formed by connecting the first and last point. |
| int | materialCount | The material count. Must be 1 or the segment count. |
| const b2SurfaceMaterial * | materials | One material for the whole chain or one for each segment. Cloned. |
| int | pointCount |
The point count. At least 2 for an open chain and at least 3 for a loop. segmentCount = isLoop ? pointCount : pointCount - 1 |
| const b2Vec2 * | points |
Array of chain points. Each consecutive pair forms a segment. For a loop the last and first point form a segment. Cloned. |
| void * | userData | Use this to store application specific shape data. |
Fill a user array with chain segment shape ids up to the specified capacity.
Returns the actual number of segments returned.
| b2ChainId b2CreateChain | ( | b2BodyId | bodyId, |
| const b2ChainDef * | def ) |
Create a chain shape.