views:

259

answers:

1

Hi,

I am trying to delete an object in box2d when 2 object collide. When my 2 objects do collide, one of the object bounces off the other. it does delete the other object, but i want it to make it look like it went through rather than a bounce.

I have my body Def type set to b2_staticBody. Any help would be appreciated.

+1  A: 

You should set the body's fixture to be a sensor:

fixture->SetSensor(true);

You then create a contact listener (class MyContactListener : public b2ContactListener) that detects collisions in the BeginContact method and checks if one of the colliding objects is of this special kind. A good way of doing that is by using these two methods:

/// Get the user data pointer that was provided in the body definition.
void* GetUserData() const;

/// Set the user data. Use this to store your application specific data.
void SetUserData(void* data);

You need to be a bit familiar with C++ to pull it off.

Felixyz