I might be wrong here, I really haven't tested this, but it seems to be linked to the ships box dimensions. If you fall out of the ships box dimensions, the gravity de-activates. If you fall into another entities box dimensions, sometimes your gravity de-activates. Beyond that, I have no idea.