PhysObj.SetBuoyancyRatio

From GMod Wiki

Revision as of 08:10, 11 October 2010 by Jcw87 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax PhysObj.SetBuoyancyRatio( Number buoyancy )
Description:
Sets the buoyancy of an object.
Returns: nil
In Object: Physobj
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=PhysObj.SetBuoyancyRatio]PhysObj.SetBuoyancyRatio [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionInitializes a SENT boat with realistic looking buoyancy.
Used onNewerServer.png
Code
function ENT:Initialize()
	self:SetModel( "models/props_wasteland/boat_fishing02a.mdl" )
 
	self:PhysicsInit( SOLID_VPHYSICS )
	self:SetSolid( SOLID_VPHYSICS )
	self:SetMoveType( MOVETYPE_VPHYSICS )
 
	local physics = self:GetPhysicsObject()
 
	if ( physics:IsValid() ) then
		physics:SetBuoyancyRatio( 0.025 )
		physics:Wake()
	end
end
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox