My boat SENT wont float no matter buoyancy ratio I use. It wont float untill i use the buoyancy tool on it.
[code]
function ENT:Initialize()
self.Entity:SetUseType( SIMPLE_USE )
self.Entity:SetHealth(5000)
self.Piloted = false
self.Pilot = nil
self.Entity:SetModel( "models/props_wasteland/boat_fishing01a.mdl" )
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
local phys = self.Entity:GetPhysicsObject()
if ( phys:IsValid() ) then
phys:SetBuoyancyRatio( 0.08 )
phys:Wake()
phys:SetMass( 10000 )
end
end
[/code]
Try this where you are setting the buoyancy
[lua]
local ratio = math.Clamp( 0, -1000, 1000 ) / 100
self.BuoyancyRatio = ratio
phys:SetBuoyancyRatio( ratio )
[/lua]
Just change the 0 in math.Clamp to whatever ratio you want, relative to the buoyancy tool
[QUOTE=Salmonman;30851688]My boat SENT wont float no matter buoyancy ratio I use. It wont float untill i use the buoyancy tool on it.
[code]
function ENT:Initialize()
self.Entity:SetUseType( SIMPLE_USE )
self.Entity:SetHealth(5000)
self.Piloted = false
self.Pilot = nil
self.Entity:SetModel( "models/props_wasteland/boat_fishing01a.mdl" )
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
local phys = self.Entity:GetPhysicsObject()
if ( phys:IsValid() ) then
phys:SetBuoyancyRatio( 0.08 )
phys:Wake()
phys:SetMass( 10000 )
end
end
[/code][/QUOTE]
I may be wrong but it might be because you're using a ridiculously high mass. Your boat is going to sink like a lead weight if its that heavy.
It seems that a higher mass will require a higher buoyancy ratio to achieve the same buoyancy. Try some different values i.e. 5, 10, 20, or higher.
Sorry, you need to Log In to post a reply to this thread.