Box2D 3.2.0
A 2D physics engine for games
Loading...
Searching...
No Matches
v3.2 Release Notes

API changes

  • Joint definitions share a common b2JointDef Base and use local frames instead of anchors, axes and reference angles.
  • Mouse joint removed, the motor joint now has spring and velocity targets.
  • Motion locks replace fixed rotation.
  • Chain shapes are segment based.
  • Contact ids (b2ContactId) in contact events, with b2Contact_GetData.
  • Pre-solve callback redesigned, plus a separate continuous pre-solve callback.
  • Native task system. Box2D runs its own threads when no task callbacks are hooked up.

New features

  • Large worlds with optional double precision (BOX2D_DOUBLE_PRECISION).
  • Recording, replay and world snapshots.
  • Contact recycling for better stability and performance.
  • Dynamic character mover with new mover and pogo joints (experimental).
  • Joint events for breakable joints (force and torque thresholds).
  • Tunable continuous collision per body (safety factor).
  • Restitution iterations and propagation.
  • Wind and drag on shapes.
  • Distance joint spring force limits.
  • Loose chain segments.
  • Runtime AVX2 dispatch with SSE2 fallback.

Improvements

  • Many optimizations.
  • Faster broad-phase and ray casts. Much less single threaded work.
  • Faster island merging and splitting.
  • Invalid input is now rejected and logged in release builds.
  • Various SIMD optimizations.

Infrastructure

  • pkg-config support.
  • Swift and Zig builds in CI.
  • MinGW and clang-cl builds.
  • CMake presets.
  • Revised samples UI and many new samples.

Breaking changes

These compile but behave differently:

  • b2RelativeAngle(a, b) swapped its arguments and still returns b minus a, so existing calls silently change sign.
  • The wheel joint axis is the x-axis of localFrameA. The old default axis was vertical, so vertical suspension now needs base.localFrameA.q = b2MakeRot(0.5f * B2_PI).
  • Motor joint defaults are now all zero, so a default motor joint does nothing.
  • b2JointType values changed, so stored joint type integers are invalid.
  • Custom filtering is opt-in per shape. The custom filter callback only runs for pairs where one of the shapes sets b2ShapeDef::enableCustomFiltering.
  • Contact recycling is on by default. A touching contact reuses its manifold and skips material updates and the pre-solve callback until the shapes move about 5cm or rotate about 11 degrees relative to each other. Disable it on the world with b2World_SetContactRecycleDistance(worldId, 0.0f) or per body with enableContactRecycling.
  • b2Normalize and b2GetLengthAndNormalize used to return zero for a length below FLT_EPSILON. Now only a squared length at or below 1000 * FLT_MIN returns zero, so tiny vectors normalize.
  • Debug draw always applies drawingBounds, so a zeroed b2DebugDraw draws nothing. Start from b2DefaultDebugDraw().
  • Body names are truncated to B2_NAME_LENGTH characters, which is 10. It was 31.
  • Contact point normal velocity is only computed if needed for hit events or restitution.
  • b2CreateSegmentShape and b2CreateCapsuleShape return b2_nullShapeId for a degenerate segment or capsule.

Renamed and changed functions: