How to make plane physics?

How could I make a plane in Roblox?

What have you tried so far? Can you show examples of what you want to make?

Depends if you want realism or not,

if you want realism then you’ll have to use real formulas

I tried using a vector force to move forward and then make the plane’s CFrame face the players mouse so it travels in the direction of the players mouse.

This didn’t work though…

1 Like

What do you mean realism?

I just want to make a plane that the player can control to move up, down, left, right etc

Could you explain what you mean?

This code won’t work, because of a flaw I just noticed. Sorry!

Oh, I thought were getting more in-depth.

In that case, you can use remote events to capture player inputs. Using these inputs, you can verify that a player is controlling a plane, then check if they input any of the control keys.

For example, if the input is W, the plane will pitch down. Similarly, if the input is S, the plane will pitch up. Etc.

It’s easier said than done and could possibly be very time-consuming. You also need to determine how the plane is controlled, who controls it, and many other variables.

I recommend possibly looking at the source code of other plane models on ROBLOX to get a general understanding of they work.

Try using basepart.AssemblyLinearVelocity (documentation) to change the velocity of a root part of the plane. Also, you have to set velocity and mouseposition on the server, not the client. You can achieve this with remote events.

EX:

local remote_event = game:GetService("Replicated Storage")['remote event here']
local speed = 100
local run_service = game:GetService("Run Service")

-- undefined variables because this is an example ( i'm not writing code for you  :) )
local mouse_position 
local rootpart
local controller

remote_event.onServerEvent:Connect(function(self, mousepos)
if self == controller or nil then
mouse_position= mousepos
end
end)

run_service.Heartbeat:Connect(function()
rootpart.AssemblyLinearVelocity = CFrame.new(rootpart.Position, mouse_position or rootpart.Position).LookVector*speed
end)
1 Like

I don’t know if you can use the AssemblyLinearVelocity, but here is a good way to do it, this code is from the Vocaloid project:
local mouse = game.Players.LocalPlayer:GetMouse()
local bodyGyro = Instance.new(“BodyGyro”, model.HumanoidRootPart)
local bodyVel = Instance.new(“BodyVelocity”, model.HumanoidRootPart)
local userInput = game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
if key == “w” then
bodyVel.Velocity = Vector3.new(0, 0, 20)
bodyGyro.cframe = CFrame.new(model.HumanoidRootPart.Position,mouse.Hit.p)
elseif key == “a” then
bodyVel.Velocity = Vector3.new(-20, 0, 0)
elseif key == “d” then
bodyVel.Velocity = Vector3.new(20, 0, 0)
elseif key == “s” then
bodyVel.Velocity = Vector3.new(0, 0, -20)
else bodyVel.Velocity = Vector3.new(0, 0, 0)
end
end)

This I know how to do, my problem is that I don’t know how to physically make the plane, meaning I don’t know what forces to use, VectorForce? LinearVelocity? I simply don’t know how to physically construct the plane.

Body velocity has been depreciated and replaced by AssemblyLinearVelocity.You can view more information on that here.