Hello,
i returned to my old project that had some weird bug.
I would like to know if anyone remembers similar bug reported here or can help me anyhow.
So it's a shooter game in c++ (box v.2.0.1) and the problem is with collision points.
For example:
I shoot a bullet that hits the wall and when i get collision point(of the bullet) i send order to destroy that bullet at the end of the iteration.
So when everything is done i destroy the bullet and body and shape that contains userdata pointer to that bullet.
Step by step in debugger i can see that memory(body,shape) is being free'd.
On the next frame however ContactListener picks up a shape of that destroyed bullet with dead pointer to destroyed bullet.
I tried to set userdatapointer to NULL before destroying shape to see what happens, and it works but half of the collisions arent picked up when i ommit the pair of points with NULL.
So it looks like the whole collision detection is extended to two frame iterations....
I'm out of ideas for dealing with this.
Im not going to change box2d version(for now, to many things changed).
I would show some code... but i cant think of any that matters... it all worked until i started to need some data from Bullet objects.
i returned to my old project that had some weird bug.
I would like to know if anyone remembers similar bug reported here or can help me anyhow.
So it's a shooter game in c++ (box v.2.0.1) and the problem is with collision points.
For example:
I shoot a bullet that hits the wall and when i get collision point(of the bullet) i send order to destroy that bullet at the end of the iteration.
So when everything is done i destroy the bullet and body and shape that contains userdata pointer to that bullet.
Step by step in debugger i can see that memory(body,shape) is being free'd.
On the next frame however ContactListener picks up a shape of that destroyed bullet with dead pointer to destroyed bullet.
I tried to set userdatapointer to NULL before destroying shape to see what happens, and it works but half of the collisions arent picked up when i ommit the pair of points with NULL.
So it looks like the whole collision detection is extended to two frame iterations....
I'm out of ideas for dealing with this.
Im not going to change box2d version(for now, to many things changed).
I would show some code... but i cant think of any that matters... it all worked until i started to need some data from Bullet objects.