14#include "box2d/color.h"
23#define B2_LITERAL(T) T
29#define B2_LITERAL(T) (T)
39#define B2_ARRAY_COUNT(A) (int)(sizeof(A) / sizeof(A[0]))
42#define B2_MAYBE_UNUSED(x) ((void)(x))
83 b2Vec2 origin, translation;
98typedef struct b2CastOutput
112typedef void b2TaskCallback(int32_t startIndex, int32_t endIndex, uint32_t threadIndex,
void* taskContext);
165 void* userTaskContext;
169static inline b2WorldDef b2DefaultWorldDef(
void)
193 b2_kinematicBody = 1,
250static const b2BodyDef b2_defaultBodyDef = {
251 b2_staticBody, {0.0f, 0.0f}, 0.0f, {0.0f, 0.0f}, 0.0f, 0.0f, 0.0f, 1.0f, NULL,
true,
true,
false,
true,
271static const b2Filter b2_defaultFilter = {0x00000001, 0xFFFFFFFF, 0};
285static const b2QueryFilter b2_defaultQueryFilter = {0x00000001, 0xFFFFFFFF};
294 b2_smoothSegmentShape,
333 NULL, 0.6f, 0.0f, 1.0f, {0x00000001, 0xFFFFFFFF, 0},
false,
true,
true,
false,
373static const b2ChainDef b2_defaultChainDef = {NULL, 0,
false, NULL, 0.6f, 0.0f, {0x00000001, 0xFFFFFFFF, 0}};
#define b2_maxPolygonVertices
Definition constants.h:47
#define b2_lengthUnitsPerMeter
Definition constants.h:22
b2Filter filter
Contact filtering data.
Definition types.h:369
int32_t stackAllocatorCapacity
Definition types.h:159
b2Vec2 linearVelocity
The linear velocity of the body's origin in world co-ordinates.
Definition types.h:214
bool fixedRotation
Should this body be prevented from rotating? Useful for characters.
Definition types.h:243
float restitution
The restitution (bounce) usually in the range [0,1].
Definition types.h:308
bool loop
Indicates a closed chain formed by connecting the first and last points.
Definition types.h:357
float s
Sine and cosine.
Definition types.h:56
int32_t jointCapacity
Capacity for joints.
Definition types.h:154
uint32_t categoryBits
The collision category bits. Normally you would just set one bit.
Definition types.h:277
void * userData
Use this to store application specific shape data.
Definition types.h:360
bool enablePreSolveEvents
Definition types.h:327
int32_t contactCapacity
Capacity for contacts. This may not be exceeded.
Definition types.h:151
float contactHertz
Contact stiffness. Cycles per second.
Definition types.h:136
float friction
The friction coefficient, usually in the range [0,1].
Definition types.h:305
int32_t groupIndex
Definition types.h:267
uint32_t maskBits
Definition types.h:262
b2Vec2 position
Definition types.h:208
bool isSensor
A sensor shape collects contact information but never generates a collision response.
Definition types.h:317
float contactDampingRatio
Contact bounciness. Non-dimensional.
Definition types.h:139
void * userData
Use this to store application specific shape data.
Definition types.h:302
b2BodyType
Definition types.h:191
float x
coordinates
Definition types.h:49
b2ShapeType
Shape type.
Definition types.h:289
uint32_t categoryBits
The collision category bits. Normally you would just set one bit.
Definition types.h:258
#define B2_LITERAL(T)
Used for C literals like (b2Vec2){1.0f, 2.0f} where C++ requires b2Vec2{1.0f, 2.0f}.
Definition types.h:29
const b2Vec2 * points
An array of at least 4 points. These are cloned and may be temporary.
Definition types.h:351
bool isEnabled
Does this body start out enabled?
Definition types.h:246
uint32_t workerCount
task system hookup
Definition types.h:162
b2BodyType type
Definition types.h:204
bool enableContactEvents
Enable contact events for this shape. Only applies to kinematic and dynamic bodies....
Definition types.h:323
b2Vec2 gravity
Gravity vector. Box2D has no up-vector defined.
Definition types.h:126
float restitution
The restitution (elasticity) usually in the range [0,1].
Definition types.h:366
float linearDamping
Definition types.h:222
bool enableSleep
Can bodies go to sleep to improve performance.
Definition types.h:142
float angularVelocity
The angular velocity of the body.
Definition types.h:217
float friction
The friction coefficient, usually in the range [0,1].
Definition types.h:363
float restitutionThreshold
Definition types.h:130
b2Filter filter
Contact filtering data.
Definition types.h:314
float density
The density, usually in kg/m^2.
Definition types.h:311
int32_t bodyCapacity
Capacity for bodies. This may not be exceeded.
Definition types.h:145
b2Vec2 cx
columns
Definition types.h:70
uint32_t maskBits
Definition types.h:281
float angle
The world angle of the body in radians.
Definition types.h:211
void * b2EnqueueTaskCallback(b2TaskCallback *task, int32_t itemCount, int32_t minRange, void *taskContext, void *userContext)
Definition types.h:116
#define B2_ZERO_INIT
Used for C zero initialization, such as b2Vec2 v = {0} where C++ requires b2Vec2 v = {}.
Definition types.h:32
float gravityScale
Scale the gravity applied to this body.
Definition types.h:230
float contactPushoutVelocity
This parameter controls how fast overlap is resolved and has units of meters per second.
Definition types.h:133
bool enableSensorEvents
Enable sensor events for this shape. Only applies to kinematic and dynamic bodies....
Definition types.h:320
int32_t count
The point count, must be 4 or more.
Definition types.h:354
void * userData
Use this to store application specific body data.
Definition types.h:233
int32_t shapeCapacity
initial capacity for shapes
Definition types.h:148
bool isAwake
Is this body initially awake or sleeping?
Definition types.h:240
void b2FinishTaskCallback(void *userTask, void *userContext)
Finishes a user task object that wraps a Box2D task.
Definition types.h:120
bool enableSleep
Definition types.h:237
float angularDamping
Definition types.h:227
void b2TaskCallback(int32_t startIndex, int32_t endIndex, uint32_t threadIndex, void *taskContext)
Definition types.h:112
Axis-aligned bounding box.
Definition types.h:75
This holds contact filtering data.
Definition types.h:256
A 2-by-2 Matrix.
Definition types.h:68
This holds contact filtering data.
Definition types.h:275
Low level ray-cast or shape-cast output data.
Definition types.h:99
2D rotation
Definition types.h:54
Used to create a shape.
Definition types.h:300
World definition used to create a simulation world. Must be initialized using b2DefaultWorldDef.
Definition types.h:124