idmillington / cyclone-physics

The Physics engine that accompanies the book "Game Physics Engine Design"
MIT License
946 stars 264 forks source link

Bug in BVHNode destruction #43

Open maximemaria opened 7 years ago

maximemaria commented 7 years ago

At line : https://github.com/idmillington/cyclone-physics/blob/master/include/cyclone/collide_coarse.h#L268

Children's parent is not updated, so the tree is no more valid. The code should be :

parent->children[0] = sibling->children[0];
if (parent->children[0]) parent->children[0]->parent = parent; 
parent->children[1] = sibling->children[1];
if (parent->children[1]) parent->children[1]->parent = parent;
ButchDean commented 7 years ago

I haven't tested the code but this could be an issue. Why not issue a pull request after you have updated and tested the code? :)