Erin,
Shouldn't the interface be consistent so that developers have one method-type where they can rely on being made aware of
any world body/structure destruction, regardless of it's cause? Just like with bodies/fixtures, SayGoodbye is a fantastic place to do any final checks/notifications/cleanup. Not only that, it is also a great place to do sanity checks and to debug unexpected destruction situations. But those advantages only work if it is called consistently and reliably regardless of the initial source of destruction.
Not to put to fine a point on it, but to quote your own words: "The intent of the SayGoodbye function is to let you nullify any references to the fixture that is being destroyed. This more important with joints, which have less clear ownership" (From post:
viewtopic.php?f=4&t=4886)
It is also worth noting that the manual does not make and distinction between implicit and explicit destruction when describing the SayGoodbye functions. So regardless of if this is changed, the manual should probably be clarified.
I realize that you may have no intention of making any changes to this behavior, but my (humble) suggestion to modify the behaviour so the SayGoodbye methods look and work like the following:
Code:
void BQDestructListener::SayGoodbye(b2Joint* joint, bool dueToBodyDestruction);
void BQDestructListener::SayGoodbye(b2Fixture* fixture, bool dueToBodyDestruction);
and even this would be quite useful:
Code:
void BQDestructListener::SayGoodbye(b2Body* body);
(Not the best param name, but you get the idea
😉 )
This way, regardless of the cause of destruction there is one central point where developers can do checks/debugging/etc. By passing the dueToBodyDestruction it will allow the developer to the scope of the destruction.... also, the SayGoodbye for the body is useful since it is actually possible to have a body exist without any fixtures...even if just by accident. Also sayGoodbye for the body would be a great addition since userdata is often attached to the body rather than the fixture (and therefore should not be released until the body is going to be destroyed).
Anyway, it's all just one person's opinion, but since userdata can be attached to any/all of these, knowing when each one is destroyed would greatly simplify coding and cleanup (and debugging) for them all.
Regards,
Q