HughPH.Box2D 2025.5.6.1836

There is a newer version of this package available.
See the version list below for details.
dotnet add package HughPH.Box2D --version 2025.5.6.1836
                    
NuGet\Install-Package HughPH.Box2D -Version 2025.5.6.1836
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HughPH.Box2D" Version="2025.5.6.1836" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HughPH.Box2D" Version="2025.5.6.1836" />
                    
Directory.Packages.props
<PackageReference Include="HughPH.Box2D" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HughPH.Box2D --version 2025.5.6.1836
                    
#r "nuget: HughPH.Box2D, 2025.5.6.1836"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=HughPH.Box2D&version=2025.5.6.1836
                    
Install HughPH.Box2D as a Cake Addin
#tool nuget:?package=HughPH.Box2D&version=2025.5.6.1836
                    
Install HughPH.Box2D as a Cake Tool

Box2D-dotnet-bindings

Box2D 3.x Bindings for dotnet (C#, F#, VB, ...)

Includes native binaries for:

Platform Architecture Tested
Windows x64 Yes
Windows x86 No
Windows arm64 No
Linux x64 Yes
Linux x86 No
Linux arm64 No
MacOS x64 No
MacOS arm64 Yes

Please submit a github issue if you try an untested platform and it works or doesn't work.

What is it?

This is a "link" from dotnet to Box2D 3.x, with an API that should be more familiar and comfortable to dotnet users. World has a Bodies property, Body has a Shapes property and a Joints property, and so on. Delegates are fully formed, rather than being vague IntPtrs. All methods and most properties are PascalCased and have XML documentation.

How is this better than Box2D.NetStandard/another port of Box2D 2.x?

Box2D 3.x contains significant efficiency improvements that make use of SIMD intrinsics. While it's not impossible to implement in C# - intrinsics have been available since dotnet 6 - it's probably unlikely that Box2D 3.x will be ported into Box2D.NetStandard: one of the challenges with Box2D.NetStandard has always been keeping it up-to-date with changes to Box2D 2.x, and the performance was never on par. Since Box2D 3.x builds to shared libraries, it makes much more sense all round to simply write bindings to that library than to put time into porting it. It also means I can target .net standard 2.1 instead of dotnet 6 or above.

How is this better than Hexa.NET.Box2D or Box2D.NET?

Hexa.NET.Box2D is auto-generated with a code generator, and is a direct mapping of the Box2D API. It's fine if you're happy dealing with pointers and Box2D's flat API. Box2D.NET is a copy-paste-fixup of the Box2D API, and is almost a direct mapping of the Box2D API. This, by contrast, is a hand-crafted API that is designed to be more idiomatic to dotnet coders. These bindings also have full XmlDoc comments and fully defined delegates. There are also method and delegate overrides which consume and deliver Spans of data instead of pointers. In this case "better" is probably subjective: this library is designed to bring quality of life improvements. This API is complete up to 3.1.0 and will be upgraded as new versions of Box2D are released.

Getting things working

Just install this package. It should work. If not, please raise an issue in the github repository

Known limitations / quirks

  • The native binaries are built from Erin's Box2D latest release tag.
  • Extensions to the Box2D API won't appear automagically. Please feel free to submit a PR if you want to add something.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2025.6.4.1142 57 6/4/2025
2025.6.4.959-vnext 57 6/4/2025
2025.5.26.1030-vnext 129 5/26/2025
2025.5.24.1211-vnext 56 5/24/2025
2025.5.21.21 141 5/21/2025
2025.5.21.1-vnext 127 5/21/2025
2025.5.20.2358-unmanageddel... 127 5/20/2025
2025.5.20.2347 129 5/20/2025
2025.5.20.859 135 5/20/2025
2025.5.19.1048-vnext 133 5/19/2025
2025.5.19.12 139 5/19/2025
2025.5.19.12-vnext 126 5/19/2025
2025.5.19.11-unmanageddeleg... 128 5/19/2025
2025.5.18.2358-unmanageddel... 133 5/19/2025
2025.5.18.2355-vnext 132 5/18/2025
2025.5.18.2353 130 5/18/2025
2025.5.18.2115-unmanageddel... 126 5/18/2025
2025.5.16.704-vnext 191 5/16/2025
2025.5.16.703 187 5/16/2025
2025.5.13.618 229 5/13/2025
2025.5.13.618-vnext 217 5/13/2025
2025.5.12.2330-vnext 226 5/12/2025
2025.5.12.2329 228 5/12/2025
2025.5.12.702-vnext 207 5/12/2025
2025.5.12.402 184 5/12/2025
2025.5.12.38 177 5/12/2025
2025.5.11.226 135 5/11/2025
2025.5.10.2207 134 5/10/2025
2025.5.10.2000 63 5/10/2025
2025.5.10.1855 66 5/10/2025
2025.5.10.755 67 5/10/2025
2025.5.10.724 62 5/10/2025
2025.5.9.509 129 5/9/2025
2025.5.8.548 146 5/8/2025
2025.5.6.2131 139 5/6/2025
2025.5.6.1836 135 5/6/2025
2025.5.6.843 129 5/6/2025
2025.5.4.2114 151 5/4/2025
2025.5.4.2048 134 5/4/2025
2025.5.4.1806 135 5/4/2025
2025.5.4.1747 138 5/4/2025
2025.5.4.1705 136 5/4/2025
2025.5.4.1538 141 5/4/2025
2025.5.4.33 105 5/4/2025
2025.5.3.2349 99 5/3/2025
2025.4.30.545 139 4/30/2025
2025.4.29.23 136 4/29/2025
2025.4.28.2119 133 4/28/2025
2025.4.28.2023 133 4/28/2025
2025.4.28.456 139 4/28/2025
2025.4.28.410 136 4/28/2025
2025.4.26.557 64 4/26/2025
2025.4.26.448 91 4/26/2025