Draw sleep velocity (#49)

- draw sleep velocity for debugging
- added back shape names with B3_SHAPE_NAME_LENGTH
- zup command line option
This commit is contained in:
Erin Catto 2026-07-05 00:33:00 -07:00 • committed by GitHub
commit 540ea387b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 554 additions and 132 deletions

View file

@ -508,7 +508,7 @@ B3_API b3BodyType b3Body_GetType( b3BodyId bodyId );
/// properties regardless of the automatic mass setting.
B3_API void b3Body_SetType( b3BodyId bodyId, b3BodyType type );
/// Set the body name. Up to B3_BODY_NAME_LENGTH characters including null termination.
/// Set the body name. Up to B3_BODY_NAME_LENGTH characters excluding null termination.
B3_API void b3Body_SetName( b3BodyId bodyId, const char* name );
/// Get the body name.
@ -729,7 +729,7 @@ B3_API bool b3Body_IsContactRecyclingEnabled( b3BodyId bodyId );
/// Enable/disable hit events on all shapes
/// @see b3ShapeDef::enableHitEvents
B3_API void b3Body_EnableHitEvents( b3BodyId bodyId, bool enableHitEvents );
B3_API void b3Body_EnableHitEvents( b3BodyId bodyId, bool flag );
/// Get the world that owns this body
B3_API b3WorldId b3Body_GetWorld( b3BodyId bodyId );
@ -846,6 +846,12 @@ B3_API b3WorldId b3Shape_GetWorld( b3ShapeId shapeId );
/// Returns true if the shape is a sensor
B3_API bool b3Shape_IsSensor( b3ShapeId shapeId );
/// Set the shape name. Up to B3_SHAPE_NAME_LENGTH characters excluding null termination.
B3_API void b3Shape_SetName( b3ShapeId shapeId, const char* name );
/// Get the shape name.
B3_API const char* b3Shape_GetName( b3ShapeId shapeId );
/// Set the user data for a shape
B3_API void b3Shape_SetUserData( b3ShapeId shapeId, void* userData );

View file

@ -98,16 +98,13 @@ B3_API float b3GetStallThreshold( void );
#define B3_TIME_TO_SLEEP 0.5f
/// Maximum length of the body name. Can be 0 if you don't need names.
/// Note: this gates recording capability.
#ifndef B3_BODY_NAME_LENGTH
#define B3_BODY_NAME_LENGTH 18
#endif
/// Maximum length of the shape name. Can be 0 if you don't need names.
/// Note: this gates recording capability.
/// todo waiting on this because it breaks existing recordings
#ifndef B3_SHAPE_NAME_LENGTH
#define B3_SHAPE_NAME_LENGTH 18
#define B3_SHAPE_NAME_LENGTH 0
#endif
/// The maximum number of contact points between two touching shapes.

View file

@ -432,7 +432,7 @@ typedef enum b3ShapeType
/// A capsule is an extruded sphere
b3_capsuleShape,
/// A compound shape composed of up to 64K spheres, capsules, hulls, and meshes
/// A baked compound shape composed of spheres, capsules, hulls, and meshes
b3_compoundShape,
/// A height field useful for terrain
@ -455,6 +455,9 @@ typedef enum b3ShapeType
/// @ingroup shape
typedef struct b3ShapeDef
{
/// Optional shape name for debugging
const char* name;
/// Use this to store application specific shape data.
void* userData;
@ -2406,11 +2409,13 @@ typedef struct b3CompoundDef
/// a mesh with many materials, you can use it outside of the compound.
#define B3_MAX_COMPOUND_MESH_MATERIALS 4
/// The runtime data for a compound shape. This is a potentially large yet highly optimized
/// The runtime data for a baked compound shape. This is a potentially large yet highly optimized
/// data structure. It can contain thousands of child shapes, yet at runtime it populates
/// into the world as a single shape in the runtime broad-phase.
/// This data structure has data living off the end and must be accessed using offsets.
/// Accessors are provided for user relevant data.
/// Note: you don't need to use this to create runtime compounds. For runtime compounds you can
/// add multiple shapes to a body using the regular shape creation functions.
typedef struct b3CompoundData
{
/// The compound version is always first.
@ -2998,6 +3003,9 @@ typedef struct b3DebugDraw
/// Option to draw the mass and center of mass of dynamic bodies
bool drawMass;
/// Option to draw the sleep information for dynamic and kinematic bodies
bool drawSleep;
/// Option to draw body names
bool drawBodyNames;