change loc.y from 0 to d/2