i created a buoyancy system for my boat using vector forces for floating up
and a vector force for water drag
i also use a vector force for a motor in the back of the boat which is controlled by the rudder’s turn
see video for better explanation of the issue
middle line is the drag force
back line is the motor force
code:
-- self.linearDrag = 7
local drag = hullBase.AssemblyMass * (-hullBase.AssemblyLinearVelocity * self.linearDrag)
self.dragForce.Force = drag
code for motor:
local speed = model.HullBase.AssemblyMass * (settings.maxSpeed * sailSpeedPercentage)
if model:FindFirstChild("Rudder") then
local rudder = model.Rudder
if not rudder:FindFirstChild("Motor") then return end
local motor = rudder.Motor
local hullBase = model.HullBase
local waterPosition = WaterService:GetWaveHeight(model.HullBase.Position, model.HullBase)
local upVector = hullBase.CFrame.UpVector
local pos = hullBase.Position
if pos.Y > (pos + upVector).Y then
motor.VectorForce.Force = Vector3.new()
return
end
if waterPosition + 10 < hullBase.Position.Y - hullBase.Size.Y / 2 then
motor.VectorForce.Force = Vector3.new()
return
end
motor.VectorForce.Force = Vector3.new(speed, 0, 0)
end
is there any other way to simulate water drag without it flinging the boat