Box2D Physics Plugin

ezgif.com-optimize

A Box2D v2.4.1 physics server for Godot Engine v4.2, implemented as a GDExtension.

Limitations

  • Missing circles and capsules skewing.
  • Missing thread-safety.
  • Missing double precision builds.
  • Missing cross platform determinism.

Differences

  • Polygons have a small skin, which can result in differences from Godot Physics.

Supported Platforms

Curently the Godot Box2d addon builds for:

  • Windows (x86_64, x86_32)
  • macOS (x86-64 + arm64 Universal)
  • Linux (x86_64)
  • Android (arm64, arm32, x86_64, x86_32)
  • iOS (arm64)
  • Web (wasm32)

Installation

  • Automatic (Recommended): Download the plugin from the official Godot Asset Store using the AssetLib tab in Godot.
  • Manual: Download the Github Release godot-box2d.zip and move only the addons\ folder into your project addons\ folder.

After installing, go to Advanced SettingsPhysics2D. Change Physics Engine to Box2D.

Features

Improved stability

  • Improved physics stability in some cases with high number of rigidbodies.

  • Improves polygon collision by fixing ghost collision.

  • Improves joints by predictive joint limits.

Determinism

Box2D is binary deterministic. Godot Box2D should also be binary deterministic, however no such tests were run yet. The newest version of Box2D, v3, will also support cross determinism. When that is done, will also add it here.

Comparison

Watch a comparison to Godot Physics 2D and Rapier 2Dn physics plugin:

Comparison

License

The Box2D library is developed and maintained by Erin Catto and is provided under the MIT license.

All code in this repository is provided under the MIT license. See LICENSE for more details and THIRDPARTY for third-party licenses.

Based on rburing/physics_server_box2d. Many thanks to you for starting implementation on this!

Note

I had to remove a lot from this as I can only put 1 image and 2 links in a post, being a forum beginner level 0.

4 Likes

The Box2D plugin imported well, but it had some undesirable behavior, in 4.2 anyway.

  1. When using one way collisions, the object would float through it strangely
  2. Pressing input against the wall would cause some slight jitter movement which would jitter the camera a bit and then occasionally would register as ‘on the floor’ and jump again (this is pressing up against a side wall)

In the end I reverted back to Godot physics and everything is working as intended again.

Thanks for trying it out.

Sorry it’s not yet 100% same as Godot Physics in terms of logic, but in terms of physical simulation it should be better(eg rigidbodies collision). If you want to help with the 2 issues, you can open GitHub issue with reproducible projects.

1 Like