Is it possible to change 2-3 times f->SetSensor() ?

Posted by Asen on Stack Overflow See other posts from Stack Overflow or by Asen
Published on 2010-05-22T02:00:17Z Indexed on 2010/05/22 2:00 UTC
Read the original article Hit count: 243

Filed under:
|
|

Hello there !

i use cocos2d-iphone-0.99.2 and integrated in it box2d. i have 2 kind of sprites with tags 1 and 2. Also i created bodies and shape definitions for them. what i'm trying to do is to make sprite1 kinds to act as solid or act as not solid when sprite2 colides with them. i tried this code :

for(b2Body *b = _world->GetBodyList(); b; b=b->GetNext()) 

{
if (b->GetUserData() != NULL) { CCSprite *sprite = (CCSprite )b->GetUserData();
if (sprite.tag == 1) { b2Fixture
f = b->GetFixtureList(); f->SetSensor(solid); } } }

Where solid is bool. The first time when i change fixture to sensor everything is just fine but when i try to revert and change again to solid my app crashes with the following error : Assertion failed: (manifold->pointCount > 0), function b2ContactSolver, file /Documents/myapp/libs/Box2D/Dynamics/Contacts/b2ContactSolver.cpp, line 58.

Is it possible somehow to change fixture->SetSensor several times and if so ... how ? Any help is highly appreciated.

© Stack Overflow or respective owner

Related posts about box2d

Related posts about cocos2d