PhysObj.SetMass

From GMod Wiki

Revision as of 17:47, 28 July 2010 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax PhysObj.SetMass( Number mass )
Description:
Sets the mass.
Returns: nil
In Object: Physobj
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=PhysObj.SetMass]PhysObj.SetMass [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates an Entity looking like a canister with 20k mass.
Used onNewerServer.png
Code
function ENT:Initialize()
	self:SetModel( "models/props_c17/canister01a.mdl" )
	self:PhysicsInit( SOLID_VPHYSICS )
	self:SetMoveType( MOVETYPE_VPHYSICS )
	self:SetSolid( SOLID_VPHYSICS )
	self:SetName("Test")
	local phys = self:GetPhysicsObject()
	if (phys:IsValid()) then
		phys:Wake()
	end
	self.Angles = self:GetAngles()
	phys:SetMass( 20000 )
	Msg(phys:GetMass( ))
end
OutputSays 20000 in server console

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox