PhysObj.SetBuoyancyRatio

From GMod Wiki

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