Collision problem on the iPhone

Hi!

I have used Box2D in a number of projects, but now I am having trouble getting collision detection to work on the iPhone. 🙁

I am using version 2.0.1 of the engine and even the most simple collisions don't work. If I place a dynamic 1x1m box above a larger static 2x1m box, the dynamic box just takes a little pause when falling on the static one, but then continues to pass through it. I put a breakpoint in b2Contact::Create() and it does create a contact when the boxes touch, but after that something seems to go wrong.

I have done only some minor changes to the code, replaced finite() with isfinite() and renamed the "cpp" file extensions "mm" to make it compile on the iphone. If I compile the same engine code in Visual Studio and run the testbed, everything seems to work fine.

Any idea on what might be going on here?

Thanks
unvestigate,

Not sure what the problem is that you are having, but have you considered trying Cocos2d for the iphone? It has the latest version of Box2d bundled within it as well as the the Box2d Testbed. Cocos2d also has it's own testbed included as well. So between the two there is a great deal of code to help you understand and use these engines.

http://www.cocos2d-iphone.org/

Best Regards,
Q
Thanks, but I cannot use that. I'm pretty much stuck with version 2.0.1 at the moment, because I need a version with a similar API to the jBox2D port. The newest version of Box2D introduces fixtures, which are not part of the jBox2D version that we use. And besides, it should work. Don't really understand what is going on...
post some code. sounds like a bad world step or badly made objects
Hi guys, I got it working. The ClipVertex objects were not created properly in the engine because of a small change I made. Peculiar how it worked on Visual Studio though. I guess some difference in the compilers...
gcc 4.0 has some bugs with agressive optimization, I suggest you to add the -fno-regmove instruction in OTHER_CFLAGS to avoid weird behavior. gcc 4.2 fix the problem.

Original thread: https://box2d.org/forum/viewtopic.php?t=4524