I am making a project in unreal engine 5, and need to find out the surface area of a mesh. example in this example, I got a basic plane I set up, and, I need to calculate the surface area of the wings, as well as the surface area of the entire plane.
it's my first time dealing with a problem like this, so, I tried to search the internet, couldn't find anything useful, so I decided to ask this question
This is fairly straightforward by using the
UProceduralMeshComponent. In Blueprints (or C++), you can copy the Static Mesh to the Procedural Mesh using the following node:You can then write a function that takes a pointer to
UProceduralMeshComponentand use the following API: https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/Components/ProceduralMesh/The function of interest is
Get Section from Procedural Meshwhich is also exposed to Blueprint scripting if that's what you prefer:Now it's just a matter of looping over all the triangles and calculating the vector product (size of the cross product of the triangle's vectors) and summing them up.