So Im currently developing a Helicopter and so far its going O.K.
My only problem right now is that the Helicopter isnt moving forward correctly.
It can go up and down, turn and “should” be moving forward when I press forward but for some odd reason its only going forward in 4 Directions.
Here is a clip of my problem: (Please note that I am always pressing forward but it only goes forward when its 90 degree to the baseplate for some odd reason)
https://i.gyazo.com/cad1fda5e18126f41742dea6c38ed15f.mp4
Currently I am using BodyAngularVelocity to rotate it and BodyVelocity to make it go up and down and BodyThrust for the forward/backwards.
--Localscript
local ContextActionService = game:GetService("ContextActionService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local plane = script.Obj.Value
local RunService = game:GetService("RunService")
local height = 0
local turn = 0
local moving = 0
local vel = plane.Main.BodyVelocity
local tru = plane.Main.BodyThrust
local ang = plane.Main.BodyAngularVelocity
local speed = 100
function MoveUp(action_name, action_state)
if action_state == Enum.UserInputState.Begin then
height = -5
end
if action_state == Enum.UserInputState.End then
height = 0
end
end
function MoveDown(action_name, action_state)
if action_state == Enum.UserInputState.Begin then
height = 5
end
if action_state == Enum.UserInputState.End then
height = 0
end
end
function MoveLeft(action_name, action_state)
if action_state == Enum.UserInputState.Begin then
turn = 1
end
if action_state == Enum.UserInputState.End then
turn = 0
end
end
function MoveRight(action_name, action_state)
if action_state == Enum.UserInputState.Begin then
turn = -1
end
if action_state == Enum.UserInputState.End then
turn = 0
end
end
function MoveForward(action_name, action_state)
if action_state == Enum.UserInputState.Begin then
moving = -50
end
if action_state == Enum.UserInputState.End then
moving = 0
end
end
function MoveBackwards(action_name, action_state)
if action_state == Enum.UserInputState.Begin then
moving = 50
end
if action_state == Enum.UserInputState.End then
moving = 0
end
end
RunService:BindToRenderStep("Update", Enum.RenderPriority.Input.Value, function()
tru.Force = Vector3.new(0,0,-moving) * 100
ang.AngularVelocity = Vector3.new(0, turn, 0)
vel.Velocity = Vector3.new(0,height,0)
end)
ContextActionService:BindAction("Up", MoveUp, false, "q")
ContextActionService:BindAction("Down", MoveDown, false, "e")
ContextActionService:BindAction("Left", MoveLeft, false, "a")
ContextActionService:BindAction("Right", MoveRight, false, "d")
ContextActionService:BindAction("Forward", MoveForward, false, "w")
ContextActionService:BindAction("Backwards", MoveBackwards, false, "s")