PhysX Candy Wrapper

PhysX™ Candy Wrapper is a C# wrapper for NVIDIA® PhysX SDK (formerly AGEIA™). It's also compatible with Visual Basic or any other .NET framework languages.

The library is open-source and customizable. You can integrate your own managed math (vector, matrix, etc.) library into the PhysX interface. Pre-built XNA, Mogre and Truevision3D compatible binaries exist.

PhysX state is manipulated through .NET-style object properties, collections, enumerations and callbacks.

Supported PhysX features

Version 2.8.1 (March/October 2008) of the PhysX SDK is supported.

Here is a list of PhysX objects that are currently accessible:

  • scenes: batched queries, overlap testing, raycasting, triggers, actor-pair/group filtering, debug renderable, active transforms
  • shapes: box, sphere, capsule, plane, triangle mesh, convex, wheel, heightfield, CCD skeletons
  • actors, materials
  • joints: cylindrical, distance, fixed, point-in-plane, point-on-line, prismatic, pulley, revolute, spherical, D6
  • fluids
  • cloth
  • soft bodies
  • force fields
  • cooking: triangle mesh, convex mesh, cloth mesh, soft body mesh
  • visual remote debugger
  • collections / (de-)serialization: binary, XML or Collada formats

If you experience any problems, please report them.

Recent changes

  • 2009-08-12
    PhysX Candy Wrapper is now compatible with XNA 3.1.
    Binaries are available for Mogre (a port of the Ogre3D) engine and Truevision3D (TV3D) engine.
    You can connect to Visual Remote Debugger.

  • 2009-06-08
    Released the eyecm-physx-xna-090608 binary, which fixes XNA quaternion conversion functions.

  • 2009-05-05
    Released the eyecm-physx-xna-090505 binary, which contains a minor bugfix.

  • 2008-10-13
    Project status went from Alpha directly to Production/Stable.
    No one complained about any bugs in the last few months, so I figured it's ok.
    Released the eyecm-physx-xna-081013 binary.

  • 2008-09-03
    Added a FAQ section. Ask away.

  • 2008-06-23
    Collection handling is (almost) complete.
    Project status is now alpha.
    Released a eyecm-physx-xna-080623alpha binary, compiled for the xna framework.

  • 2008-06-01
    Force fields are now supported.

  • 2008-05-30
    Soft bodies are now supported, cooking included.
    L33t screenshots added.

  • 2008-05-27
    Fluids are now supported. There are also some fancy array pinning tricks available for particle and mesh data readbacks.

  • 2008-05-25
    Cloth is now supported. Also cloth mesh cooking.

  • 2008-05-21
    Height fields now supported.
    Wiki is enabled. Contributions and discussion welcome.

  • 2008-05-20
    Wheel shapes and D6 joints are now supported.

  • 2008-05-14
    Initial SVN commit. The code in the repository supports the above mentioned features.


Binaries exist for

You can view the entire download section on the sourceforge part of this site and browse through all available packages.

Since all frameworks/engines don't implement all of math classes that PhysX requires (such as Triangle or Capsule), very basic implementations of these classes are provided where needed. If you're using C# 3.0 or greater, I suggest you write some extension methods for operations you need to perform on such objects.

If you want the PhysX Candy Wrapper to support some popular 3D math library out of the box, post a request in the forums and I will prepare the binaries for you. Of course, you can always build from source and use your own math library.

Build from source

PhysX Candy Wrapper was built against .NET Framework 3.5, but it compiles under the 2.0 version as well.

Only the Windows® platform is currently supported. Support for other platforms is being investigated.

You'll need a C++/CLI compiler, such as Microsoft® Visual C++® Express 2008. Older Visual C++ versions may work, but that hasn't been tested.

You can examine the source tree via the project's repository browser, or you can check-out your copy by issuing:

svn co eyecm-physx

Alternatively, you could just point your TortoiseSVN to this https address.

The PhysX SDK is not included in the source package, but is required to build the wrapper library. You need to obtain a copy of the SDK and figure out the licensing options.

Before compiling, you need to write a few short conversion methods (around 20 lines of code total) and your managed math and scene-graph classes will integrate directly into the PhysX's interface. Instructions for customization and examples are included in the source package.


PhysX Candy Wrapper is distributed under the MIT-style license.
Copyright © 2008-09 Gregor Popović.

See license.txt in the source package for details.

PhysX and NVIDIA are trademarks or registered trademarks of NVIDIA Corporation.
NVIDIA Corp. is in no way affiliated with this project or its author(s), nor does NVIDIA Corp. in any manner endorse or otherwise approve of this library.

Microsoft, Windows and Visual C++ are registered trademarks of Microsoft Corporation.