Surface Area, Center of Mass, Cross Section, and Volume

Is there any way to get the surface area, center of mass, cross-sectional area, and volume of a part, group of parts, or meshes? This is easy to get for simple shapes, such as cubes and cylinders, but gets difficult when custom shapes are applied. I am planning to use this to create somewhat of aerospace simulator, similar to Kerbal Space Program, but haven’t figured out where to start in this subject.

1 Like

If you know the mass and density of an object, you can just calculate the volume using: V(Volume) = m(Mass) / ρ(Density) You can check the density of certain materials online and multiply them with a factor so it’s suitable for Roblox.

If you take the average x,y,z of all the “corners” of your object, you can calculate the center of mass.

1 Like

For center of mass Roblox has a property which conveniently isn’t live yet: https://developer.roblox.com/api-reference/property/BasePart/CenterOfMass

for volume you can do what aux said, but instead of getting the density off the internet, you can just use ‘part.CustomPhysicalProperties.Density’

I don’t think it’s possible to do surface area/cross section through Roblox yet, in your situation are you allowed to precompute the values/use httpservice to calculate them?

Your equation is wrong. Density = Mass / Volume therefore Volume = Mass / Density.

For the cross-sectional area of a mesh, this is possible if you also import the mesh’s obj data. I don’t know the math for it, but it’s at least possible. This would also work for static unions, but you’re out of luck for dynamically created unions in-game.

4 Likes

Haven’t experimented with them, but I would if I decided to learn how to use them.