Greetings, I’m trying to make a part tilt as it turns. I’ve tried looking at old ROBLOX Boat models - But had no luck what so ever.
This is currently how piloting works - I was wondering how to make it so that it tilts as you turn.
CraftModel.Controls["Pilot"].Changed:Connect(function(Prop)
if CraftData.isFlying == true then
if Prop == "Throttle" or "Steer" then
if (CraftModel.Controls["Pilot"].Throttle == -1) then
BV.Velocity = CraftModel.Exterior["Base"].CFrame.LookVector * -CraftData.Speed
elseif (CraftModel.Controls["Pilot"].Throttle == 1) then
BV.Velocity = CraftModel.Exterior["Base"].CFrame.LookVector * CraftData.Speed
elseif (CraftModel.Controls["Pilot"].Throttle == 0) then
BV.Velocity = Vector3.new(0, 0, 0)
end
if (CraftModel.Controls["Pilot"].Steer == -1) then
BAV.AngularVelocity = Vector3.new(0, 1, 0)
elseif (CraftModel.Controls["Pilot"].Steer == 0) then
BAV.AngularVelocity = Vector3.new(0, 0, 0)
elseif (CraftModel.Controls["Pilot"].Steer == 1) then
BAV.AngularVelocity = Vector3.new(0, -1, 0)
end
end
else return end
end)
BodyGyro or AlignOrientation can both do what you are trying to achieve, the only issue is that BodyGyro only works in world space, while AlignOrientation requires a second part/attachment to work.
I’ve chosen a basic flight for my ships as the piloting won’t be the priority of the game.
However, with this being the code how would I implement the tilting upon turning?
while CraftData.isFlying == true do wait()
if (CraftModel.Controls["Pilot"].Throttle == -1) then
BV.Velocity = CraftModel.Exterior["Base"].CFrame.LookVector * -CraftData.Speed / 2
elseif (CraftModel.Controls["Pilot"].Throttle == 1) then
BV.Velocity = CraftModel.Exterior["Base"].CFrame.LookVector * CraftData.Speed
elseif (CraftModel.Controls["Pilot"].Throttle == 0) then
BV.Velocity = Vector3.new(0, 0, 0)
end
if (CraftModel.Controls["Pilot"].Steer == -1) then
BAV.AngularVelocity = Vector3.new(0, 1, 0)
elseif (CraftModel.Controls["Pilot"].Steer == 0) then
BAV.AngularVelocity = Vector3.new(0, 0, 0)
elseif (CraftModel.Controls["Pilot"].Steer == 1) then
BAV.AngularVelocity = Vector3.new(0, -1, 0)
end
end
The simplest way would be to use a small root part at the center and weld (real welds, not WeldConstraints) the main part of the model to it. Then you can tilt the whole model by changing the C0 value of the weld, while the body movers are applied to the root part.
The root part has to be heavier than the rest. Set its density in custom properties to max and try making the rest of the plane weightless. You can also increase the root part’s volume to further increase its mass, just make sure to keep it CanCollide false.