GetMass (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Emess No edit summary |
>ArceusInator reformatted the example |
||
Line 8: | Line 8: | ||
== Description == | == Description == | ||
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 (size x * size y * size x*). This can be useful to determine more than just the mass of an object, but also the size. | 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 (size x * size y * size x*). This can be useful to determine more than just the mass of an object, but also the size. | ||
{{Example|<pre> | |||
{{ | |||
myPart = Instance.new("Part") | myPart = Instance.new("Part") | ||
myPart.Parent = game.Workspace | myPart.Parent = game.Workspace | ||
Line 17: | Line 16: | ||
myMass = myPart:GetMass() | myMass = myPart:GetMass() | ||
print("My part's mass is " .. myMass) | print("My part's mass is " .. myMass) --> My part's mass is 96 | ||
--> My part's mass is 96 | </pre>}} | ||
</pre> | |||
[[Category:Methods]] | [[Category:Methods]] |
Revision as of 03:52, 30 December 2010
![]() | |
Returns | Number object mass |
Description: | Returns the Number of the object's mass. |
Member of: | BasePart |
Description
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 (size x * size y * size x*). This can be useful to determine more than just the mass of an object, but also the size.
Example
myPart = Instance.new("Part") myPart.Parent = game.Workspace myPart.Size = Vector3.new(4, 6, 4) myPart.Anchored = true myMass = myPart:GetMass() print("My part's mass is " .. myMass) --> My part's mass is 96