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.
Irrlicht, iPhysics and Mac OS X
-
- Posts: 11
- Joined: Sat Jun 30, 2007 6:50 pm
-
- Posts: 15
- Joined: Fri Jun 29, 2007 11:47 am
@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
@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
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
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.
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.
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.