Box2D Forums

It is currently Sun May 26, 2013 12:50 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Feb 19, 2012 3:48 pm 
Offline

Joined: Sun Jan 30, 2011 2:19 pm
Posts: 10
I'm currently using the following code to create a player object

Code:
   
b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody;
bodyDef.position.Set(2.0f, 0.0f);
b2Body* body = world->CreateBody(&bodyDef);

b2PolygonShape box;
box.SetAsBox(2.0f, 2.0f);

b2FixtureDef fixtureDef;
fixtureDef.shape = &box;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.3f;
body->CreateFixture(&fixtureDef);


and the following code to create a b2ChainShape

Code:
vector<b2Vec2> points;
for (int i = 0; i < 5; i ++)
{
   points.push_back(b2Vec2(i * 1.0f,1.0f));
}
b2ChainShape chain;
chain.CreateChain(&points[0], points.size());

b2BodyDef bodyDef;
bodyDef.position.Set(0.0f, 0.0f);
b2Body* body = world->CreateBody(&bodyDef);

b2FixtureDef fixtureDef;
fixtureDef.shape = &chain;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.3f;
body->CreateFixture(&fixtureDef);


But during update, when the two collide I get a crash at line 203 of b2ContactManager.cpp

Code:
      if (edge->other == bodyA)


But I'm not sure why?

Can I get some help?


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 1:54 pm 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1518
Location: Tokyo
Runs ok with 2.3.0


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 7:41 pm 
Offline

Joined: Sun Jan 30, 2011 2:19 pm
Posts: 10
I'm currently running 2.2.1, which I thought was the latest version


Top
 Profile  
 
PostPosted: Fri Feb 24, 2012 4:20 pm 
Offline
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2931
Do you have a contact listener? Try disabling that. You might be trying to modify the world somehow during the step.


Top
 Profile  
 
PostPosted: Tue Mar 06, 2012 2:53 pm 
Offline

Joined: Sun Jan 30, 2011 2:19 pm
Posts: 10
Not sure exactly what I did to fix it, but it's all fixed now... Pulled out Box2d and then put it back... All fixed now :s not sure what did that...


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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