Fortunately, you don’t have to write this code from scratch. You can basically use the code from Mesh.raycast() that performs the displacement for raycasting:
Based on this code, you can generate a new position attribute that you can use to create the geometry for your shape.
Note that this will be slow for larger meshes — both baking the mesh, and then the physics engine will probably need to compute a convex hull for each ‘frame’ in the animation. You likely need to precompute all this before rendering.