[216] | 1 | Ode.NET - .NET bindings for ODE |
---|
| 2 | Jason Perkins (starkos@gmail.com) |
---|
| 3 | |
---|
| 4 | THIS IS A WORK IN PROGRESS! I'm not done yet! |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | --------------------------------------------------------------------- |
---|
| 8 | INSTALLATION |
---|
| 9 | --------------------------------------------------------------------- |
---|
| 10 | |
---|
| 11 | Note that this binding uses a C# 2.0 feature (the |
---|
| 12 | UnmanagedFunctionPointer attribute). You will need to use |
---|
| 13 | Visual Studio 2005 (C# Express is fine) or Mono's gmcs |
---|
| 14 | compiler. |
---|
| 15 | |
---|
| 16 | Start by getting or building ODE as a shared library (DLL). |
---|
| 17 | |
---|
| 18 | The simplest way to build the bindings is probably to create a |
---|
| 19 | new library assembly in your tool of choice and drop in the files |
---|
| 20 | Ode/Ode.cs and Ode/AssemblyInfo.cs. Define the symbol`dDOUBLE` if |
---|
| 21 | you used double-precision math in your ode.dll. Build, done. |
---|
| 22 | |
---|
| 23 | For testing purposes, I have also created bindings for the |
---|
| 24 | Drawstuff library and a C# version of the BoxStack demo. You can |
---|
| 25 | throw all of these files into a console executable and run it to |
---|
| 26 | see the demo. |
---|
| 27 | |
---|
| 28 | If you happen to have Premake installed (http://premake.sf.net/), |
---|
| 29 | you can generate build scripts for the library with: |
---|
| 30 | |
---|
| 31 | premake --target (toolset) # for single precision |
---|
| 32 | premake --with-doubles --target (toolset) # for double precision |
---|
| 33 | |
---|
| 34 | To build the test application too, use: |
---|
| 35 | |
---|
| 36 | premake --with-tests --target (toolset) |
---|
| 37 | |
---|
| 38 | To build with Mono, you must add the --dotnet parameter to enable |
---|
| 39 | support .NET 2.0: |
---|
| 40 | |
---|
| 41 | premake --dotnet mono2 --target gnu |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | --------------------------------------------------------------------- |
---|
| 45 | USAGE |
---|
| 46 | --------------------------------------------------------------------- |
---|
| 47 | |
---|
| 48 | I have tried to keep things as close to the original C API as I can, |
---|
| 49 | rather than forcing a class structure on everyone. Everything is |
---|
| 50 | contained within the `Ode.NET` namespace inside a static class |
---|
| 51 | named `d`. All ODE IDs are replaced with IntPtrs. A quick example: |
---|
| 52 | |
---|
| 53 | using Ode.NET; |
---|
| 54 | |
---|
| 55 | IntPtr world = d.WorldCreate(); |
---|
| 56 | IntPtr body = d.BodyCreate(world); |
---|
| 57 | |
---|
| 58 | Take a look at Tests/BoxStack.cs for a more complete example. |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | --------------------------------------------------------------------- |
---|
| 62 | KNOWN ISSUES |
---|
| 63 | --------------------------------------------------------------------- |
---|
| 64 | |
---|
| 65 | I'm not done yet, so many functions are still missing. |
---|
| 66 | |
---|
| 67 | It is not possible to implement dBodyGetPosition(), dBodyGetRotation(), |
---|
| 68 | etc. without resorting to unsafe code, which I was trying to avoid. |
---|
| 69 | This binding uses the .NET friendly dBodyCopyPosition(), |
---|
| 70 | dBodyCopyRotation(), etc. instead. |
---|
| 71 | |
---|
| 72 | Collision response (contact joints) do not work when built under |
---|
| 73 | Mono as double-precision. I have not tried to track down why. |
---|