This repo contains C# bindings for NVIDIA PhysX as well as a Biohazrd-powered generator for generating them.
This project is not ready to be used, if you're looking for a PhysX binding for C# I'd suggest watching releases on this repository and consider sponsoring development of this library.
This repository primarily exists to serve as an example what using Biohazrd looks like today with a C++ library that has a relatively complex API. For the sake of demonstration, the output of the generator for Windows x64 is committed under InfectedPhysX/#Generated.
This project is licensed under the MIT License. See the license file for details.
Additionally, this project has some third-party dependencies. See the third-party notice listing for details.
- Ensure Git submodules are up-to-date with
git submodule update --init --recursive
- Build and run
InfectedPhysX.Generator
Note: You may see many errors and warnings during generation. This is because Biohazrd doesn't support everything in PhysX yet. These errors only indicate the corresponding APIs were skipped, so the output should still be fine as long as you don't need those APIs.
Building/running the sample is currently only supported on Windows x64 with Visual Studio 2019.
Tool | Recommended Version |
---|---|
Visual Studio 2019 | 16.9.4 |
.NET Core SDK | 5.0 |
PhysX Visual Debugger | Latest |
Visual Studio requires the "Desktop development with C++" and ".NET desktop development" workloads to be installed.
This process will be streamlined eventually. For now we're avoiding deviating too far from how PhysX is normally built.
- Ensure Git submodules are up-to-date with
git submodule update --init --recursive
- Run
external/PhysX/physx/generate_projects.bat InfectedPhysX_win64
- Open
external/PhysX/physx/compiler/InfectedPhysX_win64/PhysXSDK.sln
in Visual Studio - Build the
INSTALL
project in thechecked
configuration for thex64
platform - Start the PhysX Visual Debugger (Optional, but you won't see the output otherwise.)
- Open
InfectedImGui.sln
and build/runInfectedImGui.Sample
If you make any changes to the PhysX source code or change the branch it uses, you must re-generate the bindings using the instructions above.
Additionally you may need to rebuild PhysX if you modify the binding generator. This is because there's a small native component to expose inline methods to C# that would not otherwise get exported by the C++ compiler.