B2d_shape_chain - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
Description
Sets the given shape to a chain comprised of its currently added points. The chain shape provides an efficient way to connect many edges together to construct your static game worlds. Chain shapes automatically eliminate ghost collisions and provide two sided collision. Note: Box2D requires the points to be added clockwise, and the shape to be convex
Parameters
Parameter | Description |
---|---|
id | index of the shape |
Return Values
void: This function does not return anything.
Example Call
// demonstrates setting a chain shape, making a zigzaggy like terrain
b2d_shape_add_point(myshape, 0, 10);
b2d_shape_add_point(myshape, 10, 0);
b2d_shape_add_point(myshape, 20, 10);
b2d_shape_add_point(myshape, 30, 0);
b2d_shape_add_point(myshape, 40, 10);
b2d_shape_add_point(myshape, 50, 0);
b2d_shape_chain(myshape);
NOTOC