• News

• Industries

• Learning & Support

• Community

• Marketplace

# Calculating volume of any meshes

I am creating a simulation game, and I kinda need to calculate the volume of most meshes in the game, these meshes are both procedural AND static, and most will update often

I have found 2 ways, one by calculating the volume of every triangle to the center of mass of the object’s collision mesh (this uses less tri’s and is a better choice, I think). I found it at this post; http://n-e-r-v-o-u-s.com/blog/?p=4415
The problem here is that you need to know the exact position of every vericle (how can I get those?) in the collision mesh, and given that there are many meshes in the game the data will maybe be to much.

The other solution is creating cubic units in the mesh, I think I have a way to do that (creating a cube that’s 1cm[SUP]3[/SUP] in the center of mass of the mesh, and placing another one of these in all 6 directions, they repeat the progress and if one blocks hits the bound of the mesh he’ll stop)
Here, I again need to know the bound of the mesh and it will maybey take up unnecessarily much computing power every time it gets updated.

Can someone tell me which of these the best solution is or if there is a better one?

Hi Teunu, did you ever go any further with this? I would also like to calculate volume.

Its’ actually really simple for closed non overlapping meshes.

Great, thank you for the information!

Can I ask how you implemented this? I’m not so familiar with functions in Unreal, would it look something like this (attached picture) or is that completely wrong?

Kind Regards,

…although I guess you did it with c++