Page 1 of 1

Irrlicht, iPhysics and Mac OS X

Posted: Fri Jun 29, 2007 12:02 pm
by Sherry Haibara
Well, first of all, hi guys :) I'm a new member, as you can see. A friend of mine and I started using Irrlicht a few weeks ago for an adventure game. We decided to use Irrlicht because of its portability, and we started implementing the physics engine using Newton and iPhysics. Here is the problem.
We wrote the code on a Windows machine, and we had no problems compiling it with the physics engine, all is working well.
But when I tried porting it to Mac OS X, I got in trouble.
First of all, I found that iPhysics isn't well documented and that there isn't an official port of it for the Mac platform; so I decided to compile it by myself using X-Code 2.4, but it happened that I got thousands of error complaining something wrong about _cdecl. Searching over the net, I found that _cdecl is a Windows-specific calling convention, that Mac OS X can't understand. I tried almost everything - even delete the _cdecl from the code and include a GCC cdecl.h C++ header for Mac OS X - and finally I managed to compile it well into a .a library. I included it with libnewton32.a and Irrlicht.a in my project and everything went well. Or at least is what I thought, until I launched the program.
As a matter of fact, I discovered that the physics is only partially working: the gravity force works well, but the collisions don't. For example, many objects that I imported just go throw the floor and then fall down into the nothing, desappearing from the window.
I checked my code, and everything is OK; I compiled it with Windows 2000 and the latest release of DevC++ and everything is working just how I expected. I got this strange problem only on Mac OS X.
Agasa (which is the friend of mine who's working with me) think that the gravity callback works because it's specified in iPhysics; instead the collision callback is not working because it's hardcoded in Newton. However, we have no ideas about how to write a callback to force collisions to work.
Could anyone give me some hints? I am using Irrlicht 1.2, Newton 1.5.3 and iPhysics 1.5 on Mac OS X 10.4 Tiger.
Sherry Haibara

P.S.
Sorry for my far-from-perfect english, I'm from Italy.

Posted: Sat Jun 30, 2007 6:54 pm
by Dott. Agasa
Excuse me if i up the thread but for us it's really important, we absolutely want the game to be multiplatform and we chosen Irrlicht for this reason.
Even if you don't know how to help us, can you up the thread for keeping it alive until someone helps us? please :(

Posted: Sat Jun 30, 2007 9:19 pm
by hybrid
Although Irrlicht is portable it does not mean that all applications built with or for Irrlicht are as portable. There's definitely a chance to get the libraries to work if the libraries they rely on are (i.e. if Newton is available for Macs). But it might require considerable work.

Posted: Sun Jul 01, 2007 4:18 am
by SkaCahToa
Sorry for this not being helpful, but um are you on insanelymac? Your name seems fimilar... but i can't figure out where it's from.

Posted: Sun Jul 01, 2007 9:29 am
by Sherry Haibara
@Hybrid: actually, Newton is available for Macs, and the iPhysics library compiles well. But it stops working well when I run my game, as I explained in the first post. I know it's hard, because I think almost anybody tried to port iPhysics on Mac before.
@SkaCahToa: Well actually, I am on InsanelyMac ;)
@All: if it can help us, I can post my code and the modified iPhysics source code.
Sherry Haibara

Posted: Sun Jul 01, 2007 10:04 am
by hybrid
Having Mac code compile is only a little step towards the solution. Due to the endianess thing it's major work to get such things working. It took Irrlicht several minor releases before all that was working at least to some extent. And doing conversions between libraries can be just as hairy. I never used physics libraries myself, so I cannot say what is needed. But chances are high that this is not easily solved.

Posted: Wed Jul 11, 2007 12:58 pm
by ThomasW
Maybe it is a precision problem. Have you tried to slow down your game by increasing the steps of the physics engine per second?
If your game calculates the pyhsics every 1 second for example then it can happen that a small object is before a wall and 1 second later behind the wall and the physics engine just tests these both positions for collision and not the way between.