[ODE] .NET bindings

Daniel Huser dhuser at 1eeurope.ch
Thu Sep 21 01:08:12 MST 2006


why is it so important to avoid "unsafe" code for you?

I for my part would rather use some "unsafe" code that works 1:1 as intended, rather than having to use workarounds here and there.....

It would be great if we could get together a class structure on top of it (like OdeDotNet provides)! After all....that's what .Net people like.....a nice C# look-and-feel! :)
But maybe this could be where OdeDotNet comes in......

Great job Jason!


From: Jason Perkins
Sent: Wed 9/20/2006 16:03
To: Terry L. Triplett
Cc: ode-list
Subject: Re: [ODE] .NET bindings

On 9/20/06, Terry L. Triplett <c0d3g33k at gmail.com> wrote:
> Now that the surprise has worn off, it occurred to me that other than the
> revelation that .NET bindings were in the works, being (for now) essentially
> a one-man show, folks know little or nothing about them.  It would be
> helpful to have a bit more information to place these bindings into context.

Ode.NET - .NET bindings for ODE
Jason Perkins (starkos at gmail.com)

 THIS IS A WORK IN PROGRESS! I'm not done yet!


 Note that this binding uses a C# 2.0 feature (the
 UnmanagedFunctionPointer attribute). You will need to use
 Visual Studio 2005 (C# Express is fine) or Mono's gmcs

 Start by getting or building ODE as a shared library (DLL).

 The simplest way to build the bindings is probably to create a
 new library assembly in your tool of choice and drop in the files
 `Ode.cs` and `AssemblyInfo.cs`. Define the symbol`dDOUBLE` if you
 used double-precision math in your ode.dll. Build, done.

 For testing purposes, I have also created bindings for the
 Drawstuff library and a C# version of the BoxStack demo. You can
 throw all of these files into a console executable and run it to
 see the demo.

 If you happen to have Premake installed (http://premake.sf.net/),
 you can generate build scripts for the library with:

  premake --target (toolset)                 # for single precision
  premake --with-doubles --target (toolset)  # for double precision

 To build the test application too, use:

  premake --with-tests --target (toolset)


 I have tried to keep things as close to original C API as possible,
 rather than forcing a class structure on everyone. Everything is
 contained within the `Ode.NET` namespace inside a static class
 named `d`. All ODE IDs are replaced with IntPtrs. A quick example:

   using Ode.NET;

   IntPtr world = d.WorldCreate();
   IntPtr body = d.BodyCreate(world);

 Take a look at TestBoxStack.cs for a more complete example.


 I'm not done yet, so many functions are still missing.

 It is not possible to implement dBodyGetPosition(), dBodyGetRotation(),
 etc. without resorting to unsafe code, which I was trying to avoid.
 This binding uses dBodyCopyPosition(), dBodyCopyRotation(), etc.

 Collision response (contact joints) do not work when built under
 Mono as double-precision. I have not tried to track down why.
ODE mailing list
ODE at q12.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060921/0ad8e0ac/attachment-0001.htm

More information about the ODE mailing list