Usually when calculating the potential energy of a body it is sufficient to take its center of gravity’s distance from the ground in order to get a result according to the formula $E_p=g*h*M$. But the overall potential energy of a body should be better described as the sum of the potential energy of each and every infinitely small component of said structure, which (for a body having homogeneous density) would vary solely depend on the component’s distance from the ground.
As such, I believe that a better approach to computing the total potential energy of a body - especially if it is required great precision or if the body has “important” dimensions - would be to define it as an integral. Here is where I have to ask an input on how such an integral should be constructed: suppose I have one such very large object of conical shape with the base found at height h from the ground and the tip at a higher height H. How should an integral be written to calculate the incognita, if we assume the density and gravitational force are constant?