Trying to find a volume of a part using density/mass

Hi, im trying to figure out the volume of a part with the Shape of an Enum.PartType.Ball by dividing density by the part’s mass part:GetMass()

But i think this was a bit false, since the sphere’s size is 1,1,1. And it give me 0.523.... winch i find a bit strange since the radius of the sphere is 1, the volume should be 4.188.

i was using density / mass because it is compatible with unions and csg meshes stuff.

is this intended, or am i just being crazy…?

1 Like

mass/density instead of density/mass

local mass = part:GetMass()
local density = -- the density of the part
local v = mass / density

for scg mesh i think the mass is calculated by roblox based on the geometry of the union or mesh
image

2 Likes

image
both block and sphere size is 1,1,1
so the sphere radius is 0.5

2 Likes

tldr; a long post about me yapping about forgetting how the sphere worked, thinking that the spheres diameter equals to the radius. Size 1,1,1 should be the diameter of the sphere, meanwhile radius is half od the diameter.

forgot to mention that i already use this on my script, i tried flipping the density and the mass, got me volume of 1. flipping it again, got me 0.5. the real volume of the ball should be ~4.188.

also @EtNowis says the radius of the sphere is halfed because the way that part:getmass() was calculated.
this should make sense because the radius of a sphere is half of the circle. this diagram shows how the radius on the circle works.
17390091171266763374579420016335

I thought that the size of the ball (1 stud) correlate to the radius. (sorry, im lacking a bit of common sense there)

the difference between the size and a radius is the size is divided by 2. resulting the volume of 0.5.

so the size = diameter, and radius = size / 2. thanks for reminding me that im stupid, and dont know how the sphere works… im kinda lost at math sometimes. Im sorry if i wasted any times of yours.

1 Like

0.523 is the value if the radius is 0.5
4.188 is the value if the radius is 1.

Double check that you have the radius correct

2 Likes