GetMass (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy
added/formatted
 
>Nightname
No edit summary
 
(28 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{|
<onlyinclude>{{Method
|<onlyinclude>{{Method|name = GetMass
|name = GetMass
|arguments =
|returns = [[Number]] ''object mass''
|returns = [[Number]] ''object mass''
|description = Returns the [[Number]] of the object's mass.
|description = Returns the [[Number]] of the object's mass.
|object = [[BasePart]]
|object = BasePart
|}}</onlyinclude>
}}</onlyinclude>
|}
 
{{clear floats}}
 
== 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 z*). This can be useful to determine more than just the mass of an object, but also the size.
 
{{Example|<pre>
local myPart = Instance.new("Part")
myPart.Parent = game.Workspace
myPart.Size = Vector3.new(4, 6, 4)
myPart.Anchored = true
 
local myMass = myPart:GetMass()
 
print("My part's mass is " .. myMass) --> My part's mass is 96
</pre>}}
 
[[Category:Methods]]

Latest revision as of 01:03, 19 February 2012

GetMass( )
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 z*). This can be useful to determine more than just the mass of an object, but also the size.

Example
local myPart = Instance.new("Part")
myPart.Parent = game.Workspace
myPart.Size = Vector3.new(4, 6, 4)
myPart.Anchored = true

local myMass = myPart:GetMass()

print("My part's mass is " .. myMass) --> My part's mass is 96