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  b2ChainId
 Chain id references a chain instances. 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...
 

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.
 

Functions

uint64_t b2StoreBodyId (b2BodyId id)
 Store a body id into a uint64_t.
 
b2BodyId b2LoadBodyId (uint64_t x)
 Load a uint64_t into a body id.
 
uint64_t b2StoreShapeId (b2ShapeId id)
 Store a shape id into a uint64_t.
 
b2ShapeId b2LoadShapeId (uint64_t x)
 Load a uint64_t into a shape id.
 
uint64_t b2StoreChainId (b2ChainId id)
 Store a chain id into a uint64_t.
 
b2ChainId b2LoadChainId (uint64_t x)
 Load a uint64_t into a chain id.
 
uint64_t b2StoreJointId (b2JointId id)
 Store a joint id into a uint64_t.
 
b2JointId b2LoadJointId (uint64_t x)
 Load a uint64_t into a joint id.
 

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 generation
uint16_t index1

◆ b2BodyId

struct b2BodyId

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

Data Fields
uint16_t generation
int32_t index1
uint16_t world0

◆ b2ShapeId

struct b2ShapeId

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

Data Fields
uint16_t generation
int32_t index1
uint16_t world0

◆ b2ChainId

struct b2ChainId

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

Data Fields
uint16_t generation
int32_t index1
uint16_t world0

◆ b2JointId

struct b2JointId

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

Data Fields
uint16_t generation
int32_t index1
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.generation == id2.generation )

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.