so i’ve tried reading all over the forum and have went thru several different resources to cap the speed of my boat with vector force.
i tried this solution but if i have a max speed of 10 for my boat, it will exceed that speed; hence not enough drag but idk how to fix it. tysm!!!
How do I limit the velocity of VectorForce? - #20 by dthecoolest
function boat:HandleThrust()
local rs = game:GetService("RunService")
if not self.connection then
self.connection = rs.Stepped:Connect(function(dt)
local XZVector = Vector3.new(1,0,1)
local velocity = self.vehicleSeat.AssemblyLinearVelocity
local speed = velocity.Magnitude
print(speed)
self.thrust.Force = Vector3.new(self.vehicleSeat.ThrottleFloat * 2000,0,0)
--print(self.thrust.Force)
if speed > self.config:GetAttribute("MaxSpeed") then
self.drag.Force = -velocity.Unit*(speed^2)*XZVector
print({"thrust: ", self.thrust.Force,
"drag: ", self.drag.Force
})
else
self.drag.Force = Vector3.new()
end
end)
end
end
and what it printed: