Get static mesh surface height?

Given an X & Y coordinate, I need to find the top-most surface values (Z-axis) of any given static mesh, as well as the distance from the lowest point (Z-axis) of the mesh, resulting in the exact height for that XY coordinate.
The most logical thing I can think of is raycasting and some AABB math, except that the static mesh is not actually added to the scene during the time that this calculation needs to be made. In fact, there is no intention of ever adding this mesh to the scene, because it’s meant to only be used as reference in order to build a procedural mesh with similar Z-offsets.

How could this be achieved?

After searching all that below this I found:

UStaticMesh::GetBounds()

which will return you a FBoxSphereBounds. Just take the box extent’s Z value.

In StatishMesh.h you find a

    /** Simplified collision representation of this  */
UPROPERTY()
struct FKAggregateGeom AggGeom;

which itself has a function

FBox CalcAABB(const FTransform& Transform) const; .

Or there’s a

    // Physics data.
UPROPERTY(EditAnywhere, transient, duplicatetransient, Instanced, Category = StaticMesh)
class UBodySetup* BodySetup;

and in there

	/** Default properties of the body instance, copied into objects on instantiation, was URB_BodyInstance */
UPROPERTY(EditAnywhere, Category=Collision, meta=(FullyExpand = "true"))
struct FBodyInstance DefaultInstance;

which has

/** Return bounds of physics representation */
FBox GetBodyBounds() const;

I believe this will only calculate the bounding box for the mesh as a whole, and will not return the surface (Z coordinate) of the mesh at a given XY coordinate. While this may be a necessary piece of the puzzle, what I truly need is a way to determine the height of the mesh at certain points along the XY plane.

For the time being, I’ve decided to go with the utilization of a height map instead.
But this question is still valid, and any applicable answer will be marked appropriately in the future.

Aha, got you…

I’m actually looking for something similar: Closest path to volume - Programming & Scripting - Epic Developer Community Forums

My idea was to search for the closest poly (considering my search of being closest to an actor, you can easily change this to be closest to XY coord of your choosing plus the limitation of only highest/lowest vertices) and then do a

FMath::ClosestPointOnTriangleToPoint(const FVector& Point, const FVector& A, const FVector& B, const FVector& C)

It would require testing against all polygons/triangles originating from the found vertex. Though in your case you’d maybe want to take a line reaching from the -Z and +Z of the bounding box with the desired XY coordinates and then check for collision.

Maybe it would be possible to do a raycast from either side (I believe you’d have to make sure that it’s doing a complex query).

That’s the problem though. How do you hit test a mesh that hasn’t been added to the world yet? Your answers have all been addressed in my original question: “The most logical thing I can think of is raycasting and some AABB math, except that the static mesh is not actually added to the scene during the time that this calculation needs to be made.”
The data is read in the constructor, so there is no access to the world because it doesn’t exist until I hit the play button. And since I’m just gathering data to aid in the creation of another mesh, there’s really no point spawning it into the world in the first place.