Box2D 3.1.0
A 2D physics engine for games
Loading...
Searching...
No Matches
Ids

These ids serve as handles to internal Box2D objects. More...

Data Structures

struct  b2WorldId
 World id references a world instance. This should be treated as an opaque handle. More...
 
struct  b2BodyId
 Body id references a body instance. This should be treated as an opaque handle. More...
 
struct  b2ShapeId
 Shape id references a shape instance. This should be treated as an opaque handle. More...
 
struct  b2JointId
 Joint id references a joint instance. This should be treated as an opaque handle. More...
 
struct  b2ChainId
 Chain id references a chain instances. This should be treated as an opaque handle. More...
 

Macros

#define B2_IS_NULL(id)
 Macro to determine if any id is null.
 
#define B2_IS_NON_NULL(id)
 Macro to determine if any id is non-null.
 
#define B2_ID_EQUALS(id1, id2)
 Compare two ids for equality. Doesn't work for b2WorldId.
 

Detailed Description

These ids serve as handles to internal Box2D objects.

These should be considered opaque data and passed by value. Include this header if you need the id types and not the whole Box2D API. All ids are considered null if initialized to zero.

For example in C++:

b2WorldId worldId = {};
World id references a world instance. This should be treated as an opaque handle.
Definition id.h:38

Or in C:

b2WorldId worldId = {0};

These are both considered null.

Warning
Do not use the internals of these ids. They are subject to change. Ids should be treated as opaque objects.
You should use ids to access objects in Box2D. Do not access files within the src folder. Such usage is unsupported.

Data Structure Documentation

◆ b2WorldId

struct b2WorldId

World id references a world instance. This should be treated as an opaque handle.

Data Fields
uint16_t index1
uint16_t revision

◆ b2BodyId

struct b2BodyId

Body id references a body instance. This should be treated as an opaque handle.

Data Fields
int32_t index1
uint16_t revision
uint16_t world0

◆ b2ShapeId

struct b2ShapeId

Shape id references a shape instance. This should be treated as an opaque handle.

Data Fields
int32_t index1
uint16_t revision
uint16_t world0

◆ b2JointId

struct b2JointId

Joint id references a joint instance. This should be treated as an opaque handle.

Data Fields
int32_t index1
uint16_t revision
uint16_t world0

◆ b2ChainId

struct b2ChainId

Chain id references a chain instances. This should be treated as an opaque handle.

Data Fields
int32_t index1
uint16_t revision
uint16_t world0

Macro Definition Documentation

◆ B2_ID_EQUALS

#define B2_ID_EQUALS ( id1,
id2 )
Value:
( id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.revision == id2.revision )

Compare two ids for equality. Doesn't work for b2WorldId.

◆ B2_IS_NON_NULL

#define B2_IS_NON_NULL ( id)
Value:
( id.index1 != 0 )

Macro to determine if any id is non-null.

◆ B2_IS_NULL

#define B2_IS_NULL ( id)
Value:
( id.index1 == 0 )

Macro to determine if any id is null.