GetMass (Function): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Sncplay42 No edit summary |
>Sncplay42 No edit summary |
(No difference)
|
Revision as of 13:22, 4 September 2010
The GetMass function returns a Number value of the object's mass. Currently, all objects in Roblox have a density of 1, which means the GetMass returns the same value as the Volume of the object. This can be useful to determine more than just the mass of an object, but also the size.
Different shapes of part (such as ball and wedge) will have different volumes with the same Size property. The GetMass function takes this into account when calculating the mass of a part.
--get the mass of a 1x1x1 block shaped part local part = Instance.new("Part") part.formFactor = "Symmetric" part.Size = Vector3.new(1,1,1) print(part:GetMass()) --outputs "1" --get the mass of a 1x1x1 ball-shaped part part = Instance.new("Part") part.Shape = "Ball" part.Size = Vector3.new(1,1,1) print(part:GetMass()) --outputs "0.52359879016876"