destroyBody method
Destroys body and every joint holding it. Only bodies createBody
made: a character's body (characterBody) goes with its character.
Implementation
@override
void destroyBody(int body) {
// Only bodies made by createBody: a character's stand-in body belongs to
// its character, and destroying it here would destroy it twice.
if (_gone) return;
final shape = _bodyShapes.remove(body);
if (shape == null) return;
_bodyTypes.remove(body);
jj_body_destroy(body);
shapes.release(shape);
// The native layer destroyed the joints holding it.
for (final joint in _bodyJoints.remove(body)?.toList() ?? const <int>[]) {
_forgetJoint(joint);
}
}