update to calculate the center of mass position as well