Box2d - 2D physics

Previous topic - Next topic


The issue could be not GLB related regarding box-to and poly-to collison and I tried setting the those flags in Xcode/Other C Flag and GLB CMP but no difference on compile.

Adding this to the Box2D.h enabled WinCE compile. It's slow but a quick test it works. Thanks KH.  :booze:
Code (glbasic) Select

inline float cosf(float c){return cos(c);}
inline float sinf(float c){return sin(c);}
inline float sqrtf(float c){return sqrt(c);}
inline float atan2f(float c){return atan2(c,c);}

In the meantime I made this cool 3D pool demo (WIP maybe)!  :P :-[ :good:

Kitty Hello

Didn't you solve the box-box collision bug by making boxes from poly-objects?


Hello Gernot!
The bug is box to box, box to poly,  poly to poly,
The only thing that works is circle to everything else  including circle to circle.

Did you read the post in the box2d forum??
That guy had exactly the same problem, under windows run ok but have that bug on the iphone...

Finally he found the problem and solution:

"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..."

I don't understand nothing about ClipVertex objects  and how GLbasic is handling =D  but I guess that there is the problem, maybe you need to change something ...

Gernot, we believe in you!  :good:

Kitty Hello

his option was to put the "--no-idunnowhat" flag in the CMP box for the iPhone platform in project options.


Are you talking about this???:

"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."

That's another guy telling that is a good practice to compile with that flags, but he found the solution before that and the solution was on Clipvertex Object's side.

Matchy tried setting those flags in Xcode/Other C Flag and GLB CMP but no difference on compile.


Kitty Hello

Did he fix box2d and submit the code?


Umm I think that he fix his engine if I don´t understood wrong  :blink:


The issue with non circle body collision (circle to box/poly is okay) when compiling for iPhone is lurking a dark cloud and needs to be resolved soon.
I tried the "-fno-regmove" flag in both GLB project options; CMP and, as suggested, in OTHER_CFLAG in XCode but neither made any changes.

I afraid to think about Kitty Hello's suggestion was to import the box2d framework into xcode. :(


Matchy I agree with you, It's needs to be resolved soon !!
Maybe Kitty can contact Erin Catto to ask about this issue  ;)


Is there any way to delete a box after creating it? As far as I know there is no function for that in the Box2d.gbas. I tried to do it myself, but how do I include "void b2World::DestroyBody(b2Body* body)"? I have no clue of C++.


try this (copy this function into the box2d.gbas):

Code (glbasic) Select

FUNCTION b_destroyBody: body%

Hope it works =)


Nice 1 backslider! It works.

I have the urgend feeling that the port is nearly complete if everybody would insert the parts on their harddrives.

To all the heavy-users:
The ordinary GLB user can´t make any games with this. Until now there wasn´t even a way to delete objects. So please start a community edition where you add your parts. :nw:


I will search all box2d functions in the forum, add it to the .gbas of this thread and then I will add it here as "userfriendly" box2d-lib :P

If it´s OK for you :D
I need the lib, too.


Edit: Now I added all functions from this thread.

edited functions:
- b_CreateCircle (extended parameters)
- b_CreateBox    (extended parameters)
- b_CreatePoly   (extended parameters)

new functions:
- b_DestroyJoint% (function has now code to destroy joints)
- b_destroyBody    (delete bodys that you don´t need)

That´s all I can find, but should be enough for GLBasic!?! =)

[attachment deleted by admin]


Hello to all....
I was searching and searching :)  and I found this:

Matchy, what do you think?
I can't test nothing because I'm at work, If you finally find the solution please share !!!   =D


blackway, you thread find has lead me to the solution to iPhone box to box collision!!!  :enc:  :whistle: Simply add -O2 to the cmp. ;)   :good:

I'm thirsty.  :coke: :coke: :coke: