Box2D Forums

It is currently Sat May 25, 2013 9:50 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Oct 24, 2011 11:18 am 
Offline

Joined: Mon Oct 24, 2011 10:33 am
Posts: 3
Hello. I'm new to the forum.

[spelling edited here]
I'm going to start the story....
I'm building a simple 2D OpenGL Game Engine to the college dissertation.

A part of this Engine is an integration with an Physics Lib/Engine. Steps:

- I have built a class that holds and initialize the b2World:
Code:
b2Vec2 gravity(0.0f, 10.0f);
world   = new b2World(gravity);
world->SetAllowSleeping(true);

- This class have a method to simple create box fixture
Code:
//METHOD LOCAL SCOPE

b2PolygonShape pShape;
pShape.SetAsBox(newSize.X, newSize.Y);

b2FixtureDef fDef;

fDef.shape = &pShape;
//method param friction
fDef.friction = friction;
//method param density
fDef.density = density;
//this pointer is saved on a list after the method finishes
b2Fixture *pFix = bodyComp->body->CreateFixture(&fDef);


- I have simple compiled Box2D 2.2.1 as static library with Eclipse Indigo (CDT -> GNU GCC) on MacOSX Leopard 10.5 [<- its Leopard not Lion that makes all difference].
And then compiled the engine and test app projects (Success).

- The engine test application is very simple:
A Rocket as body with type 'b2_dynamicBody' and box shape on fixture
and 2 more bodies with 'b2_staticBody' body type.
One fixture per body.

- The engine is cross and then compiled on windows (Eclipse Indigo -> MinGW).
And there no problems at all. Only MacOSX Lion problems related.

- The problem is occurring during the execution process:
Assertion failed: (s_initialized == true), function Destroy, file ../Box2D/Dynamics/Contacts/b2Contact.cpp, line 103.

When the rocket collides with static bodies everything is ok and work. But when he leaves the collision the problem reaches.
This means that b2Contact wasn't initialized or 's_initialized' flag !? And then don't know why it occurs only on Mac.

It looks a simple problem, maybe a mistake.
Any light ?
Thanks everything.


Top
 Profile  
 
PostPosted: Thu Nov 03, 2011 12:55 pm 
Offline

Joined: Mon Oct 24, 2011 10:33 am
Posts: 3
Guys, i'm here to feedback about the problem.

After aloooooooooootttt of tests, i've found a way to cause and fix the problem. So.. I think i found the solution.

My Game uses my engine called HGEngine that helps me to manage the Box2D elements (initialize, convert values, add fixtures, process steps)

The engine is an Shared Library that compiles using Box2D static library.

The Game need to compile referencing the engine -lHGEngine and Box2D.

The problem is caused when Box2D is referenced before the engine on game compilation. I've changed the order of library references compile and execute, so everything goes fine.

I've saw Box2D works with static values, like this s_initialize. So maybe the compiler was creating a reference for s_initialize to the Engine different than s_initialize reference to the game, so it has no effect to the execution.

Thanks. Sorry for the bad english.


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 12:03 am 
Offline

Joined: Mon Apr 30, 2012 12:00 am
Posts: 1
I would really like to know how you got Box2D to build and work under Eclipse in Mac OSX 10.6.8. I am not that experienced with CMake and I cant use Xcode 4. A short tutorial would really help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group