I am currently working on a hovercraft. The functionality is all but done, except I don’t think I have quite mastered the forces for the thrusters because the hovercraft likes to bob up and down and smack into the ground when it feels like it… which obviously isn’t ideal (lol).
Video Example:
https://gyazo.com/e6d40bad347a3f8d3112c89fc9e941a4
Thruster Code:
function Hovercraft:UpdateThruster(thruster: part)
local hover = thruster.Thrust
local direction = -thruster.CFrame.UpVector * settings.DETECT_RANGE
local result = workspace:Raycast(thruster.Position, direction, self.params)
if result and result.Instance.CanCollide then
local distanceToGround = thruster.Position - result.Position
local offset = 1 + (settings.HOVER_HEIGHT - distanceToGround.Magnitude) * settings.OFFSET_MULTIPLER
hover.Force = Vector3.new(-self.base:GetMass() * workspace.Gravity * offset / 4)
else
hover.Force = Vector3.new(0, 0, 0)
end
end
Any help is much appreciated. If you think the issue could be because of code other than what was provided, let me know. The player is massless and the mass of the actual hovercraft is accounted for in the force calculation, so I don’t think it is a mass issue.