-
Notifications
You must be signed in to change notification settings - Fork 0
B2d_shape_chain
hpgDesigns edited this page Aug 8, 2021
·
1 revision
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
| Parameter | Description |
|---|---|
| id | index of the shape |
void: This function does not return anything.
// 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
This is number 1