local seat = script.Parent
local zeppelin = seat:FindFirstAncestor("Zeppelin-1")
local body = zeppelin:FindFirstChild("BODEY_Ellipsoid-Model-Zepelin", true)
local linearVelocity = body:FindFirstChild("LinearVelocity")
local alignOrientation = body:FindFirstChild("AlignOrientation")
local vectorForce = body:FindFirstChild("VectorForce")
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
vectorForce.Force = Vector3.new(0, body:GetMass() * workspace.Gravity, 0)
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.World
local SPEED = 30
local TURN_SPEED = 60
local LIFT_SPEED = 15
local yaw = 0
alignOrientation.RigidityEnabled = false
alignOrientation.MaxTorque = 100000
alignOrientation.MaxAngularVelocity = math.huge
alignOrientation.Responsiveness = 25
linearVelocity.MaxForce = 100000
linearVelocity.RelativeTo = Enum.ActuatorRelativeTo.World
linearVelocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
RunService.Heartbeat:Connect(function(dt)
if not seat.Occupant then
linearVelocity.VectorVelocity = Vector3.zero
return
end
local moveDir = Vector3.zero
local verticalDir = 0
if UIS:IsKeyDown(Enum.KeyCode.W) then
moveDir = moveDir + Vector3.new(math.sin(math.rad(yaw)), 0, math.cos(math.rad(yaw)))
end
if UIS:IsKeyDown(Enum.KeyCode.S) then
moveDir = moveDir - Vector3.new(math.sin(math.rad(yaw)), 0, math.cos(math.rad(yaw)))
end
if UIS:IsKeyDown(Enum.KeyCode.A) then
yaw = yaw - TURN_SPEED * dt
end
if UIS:IsKeyDown(Enum.KeyCode.D) then
yaw = yaw + TURN_SPEED * dt
end
if UIS:IsKeyDown(Enum.KeyCode.Space) then
verticalDir = 1
end
if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then
verticalDir = -1
end
local targetVelocity = (moveDir * SPEED) + Vector3.new(0, verticalDir * LIFT_SPEED, 0)
linearVelocity.VectorVelocity = linearVelocity.VectorVelocity:Lerp(targetVelocity, dt * 3)