def mass_center(model, sim):
    mass = np.expand_dims(model.body_mass, 1)
    xpos = sim.data.xipos
    return (np.sum((mass * xpos), 0) / np.sum(mass))[0]
def mass_center(model, sim):
    mass = np.expand_dims(model.body_mass, 1)
    xpos = sim.data.xipos
    return (np.sum((mass * xpos), 0) / np.sum(mass))[0]