Free physics library wrapper: miniODE-bmx port

BlitzMax Forums/MiniB3D Module/Free physics library wrapper: miniODE-bmx port

Warner(Posted 2011) [#1]
The download contains a BMX (+minib3d) port of miniODE. Thank you Alex, for sharing it.
I've included functions that allow for compiling the first example. The joint-related functions are not converted yet.
I recompiled the .DLL with an altered function, so that the wrapper doesn't rely on AlignToVector. Rotations are written into the Entities matrix directly.
The advantage should be that this method is fast. The disadvantages are: the z-axis is inverted. Also, you can't use EntityParent on physics-controlled Entities, since the regular minib3d updating is skipped.
Still, it should be fun to play with.
Download:
miniODEbmx.zip


ima747(Posted 2011) [#2]
Very cool project, keep us posted.

I've never played with miniODE, are there mac/linux variants? would love to have cross platform physics module that meshed nicely with miniB3d.

Perhaps there could be an option added (per entity would be best, but I would assume that a master flag or compile option would be more practical) to use move/position entity commands rather than modifying the matrix's directly. Would sacrifice speed (a fair amount I would guess, depending on the model etc...) but would allow parenting to work and fix the axis issue... for me parenting would likely be a bigger deal that speed for many projects.

The alternative I guess would be to parent things to a pivot and then after the physics update position the pivot on the entity that you would normally have parented too... not very elegant, but easily managed in via OOP.


Warner(Posted 2011) [#3]
miniODE is a wrapper for ODE, so if ODE is crossplatform, miniODE could be crossplatform as well. I think you can write a dynamic lib for Linux/Mac, but I don't know how. However, the DLL source is included in the download. I just altered this one function to get it to write to the matrices directly:
In my own adaptation of minib3d, I can overwrite the rotation matrix, and the parenting system still works. I think however it should be possible to extract Pitch/Yaw/Roll values from the matrix. Keep in mind tho, that I swapped some of the values in the matrix (see routine above)

Last edited 2011


Yasha(Posted 2011) [#4]
are there mac/linux variants?


In a word, no, because I wrote it as a wrapper for Blitz3D, where that wasn't an issue.

However, none of my code is platform-specific. You should be able to just plug most of it into a *nix project and go. All of my own code is in just the one file, with the exception that some of the real ODE functions that were also directly exported had to have their calling convention changed to stdcall.

I don't really know anything about how BlitzMax interfaces with C++, but I'd actually assumed you could just import this (or ODE itself, if you felt so inclined) as C++ modules or something like that?

For that matter... didn't Klepto's extended miniB3D already have a full ODE version built in? That might be worth a look for a cross-platform solution.

Anyway, it's a great honour to see someone finding a use for this!


Warner(Posted 2011) [#5]
Thank you Yasha. For me, using your wrapper made things much easier. I just need some basic physics functionality, and using ODE directly was a bit over my head I'm afraid. Now I can just modify small parts of it so it fits my engine. Thus far, it all works very well.

Update for people who read this later on: I've decided to drop ODE in favor of Newton. When I tried adding static Triangle-based meshes, they seem to work not so well. I needed to decrease the stepsize much, and even then every once in a while, I felt through a floor or a wall. Now, using Newton, hopefully I have no such trouble anymore.
I had difficulty finding a good Newton example on the forums. You should download minib3d-extended version. It has a statically linked version of Newton included.

I'm using my own engine, which is sort of a simplified version of minib3d.
However, it should not be a great deal of trouble converting it back to minib3d.
Here is my code so far, heavily based on the original minib3dext example:


Last edited 2011


outsider(Posted 2011) [#6]
@Warner: download link is broken.


Warner(Posted 2011) [#7]
Ah, I seem to have deleted the file. I uploaded it again.


outsider(Posted 2011) [#8]
Thanks :)


Hezkore(Posted 2011) [#9]
Warner, you should share your Newton package from minib3dext. :P


outsider(Posted 2014) [#10]
Warner, could you please upload it one more time?


kiami(Posted 2014) [#11]
How about openODEbmx for openB3D? I have no idea about writing BMAX wrapper, otherwise, I would do so. If someone point me to a good tutorial for writing BMAX wrapper code, I may try it.