- Home /
The question is answered, right answer was accepted
Understanding mesh volume
I wanted to know how calculate a mesh volume so I read these threads: http://answers.unity3d.com/questions/52664/how-would-one-calculate-a-3d-mesh-volume-in-unity.html and http://forum.unity3d.com/threads/figuring-out-the-volume-and-surface-area.117388/
I tested all these stuff with cubes and spheres. It works, but not how I expected. I didn't understand why I change the object scale and the volume value does not change. Even if transform the vertice position to world position the result is the same. Or I didn't understand what approach I'm looking for. Any tips? thanks in advance.
Answer by Pangamini · Aug 25, 2016 at 01:21 PM
By scaling the object, you mean scaling the transform of the gameObject I guess? If that's the case, it doesn't affect the mesh data in any way. The mesh is used for rendering on the same GO, but the data in the mesh is the same - it's not scaled. If you want to calculate a volume of a mesh attached to a specific gameObject, you will need to do it on the gameObject level - calculate the volume of the mesh, then multiply it by the lossy scale of the transform the renderer is attached to. And by that I mean multiplying the volume (which is a scalar) by every element of the scale vector.
Follow this Question
Related Questions
Find all triangles inside given bounds 1 Answer
How to flatten 3d image STL to 2d 0 Answers
How do i replace a Mesh Filter?? 1 Answer
create a polygon mesh from a set of points 1 Answer
How to make 3D colliders on sprites? 0 Answers