Hi, I’m making a working boat but the water clips into it and I can’t make it any higher without making it look bad. How would I address this issue?
local captainSeat = script.Parent.CaptainSeat
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {workspace.Terrain}
Params.FilterType = Enum.RaycastFilterType.Include
captainSeat.Changed:Connect(function()
script.AngularVelocity.AngularVelocity = Vector3.new(0, -1 * captainSeat.Steer, 0)
script.LinearVelocity.LineVelocity = 50 * captainSeat.Throttle
end)
while task.wait() do
local startingPos = script.Parent.CaptainSeat.Position + Vector3.new(0,5,0)
local endingPos = script.Parent.CaptainSeat.Position - Vector3.new(0,15,0)
local ray = workspace:Raycast(startingPos,endingPos - startingPos, Params)
if ray and ray.Material == Enum.Material.Water then
script.AngularVelocity.Enabled = true
script.LinearVelocity.Enabled = true
else
script.AngularVelocity.Enabled = false
script.LinearVelocity.Enabled = false
end
end