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 and replay, plus world snapshots (experimental).
  • 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.
  • Continuous sensor events. Fast shapes are swept against static sensors, and bullets against all non-bullet sensors.
  • 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.
  • Kinematic bodies are cheaper. Graph coloring treats them like static bodies.
  • More stable prismatic joint under stress.
  • More accurate rotational inertia for shapes far from the body origin.
  • Invalid input is now rejected and logged in release builds.
  • Various SIMD optimizations.

Infrastructure

  • pkg-config support.
  • Swift and Zig builds in CI.
  • MinGW, clang-cl and Windows ARM64 builds.
  • JSON descriptions of the public API in api/ for binding generators, one per precision.
  • 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.
  • Fields were reordered in b2BodyMoveEvent, b2PrismaticJointDef and b2DebugDraw. A positional initializer can still compile and fill the wrong fields.
  • A joint between two bodies that are not dynamic is not simulated.
  • World shape casts ignore chain segments approached from the back side.
  • Contact push speed no longer depends on the contact hertz and damping ratio.
  • b2ManifoldPoint::totalNormalImpulse now includes the warm starting impulse.

Renamed and changed functions: