Hi!!
I am quite new to vehicle development,
I tried with a simple script.
Keys are basically a table containing keys are pressed, if keys are pressed it returns true (ignore it xd)
I think you should understand this
local function fly()
Xrotation = Xrotation == -0.2 and 0.2 or Xrotation == 0.2 and -0.2
ExpectedGyroCFrame = CFrame.new(Mainpart.CFrame.Position)
if Keys.E then
ExpectedSpeed = Vector3.new(ExpectedSpeed.X,math.clamp(Force.Velocity.Y + 1,1/math.pi,15),ExpectedSpeed.Z)
local xD = 0
print(Xrotation)
if tick() - lastT > 0.2 then
lastT = tick()
ExpectedGyroCFrame = CFrame.new(Mainpart.CFrame.Position) * CFrame.Angles(math.rad(Xrotation),0,math.rad(Xrotation))
end
else
ExpectedGyroCFrame = CFrame.new(Mainpart.CFrame.Position)
ExpectedSpeed = Vector3.new(ExpectedSpeed.X,math.sin(tick()),ExpectedSpeed.Z)
end
if Keys.W then
Speed = math.clamp(Speed + 0.1,0,120 --[[maxspeed]])
local yes = Mainpart.CFrame.LookVector.Unit * Speed
ExpectedSpeed = Vector3.new(yes.X,ExpectedSpeed.Y,yes.Z)
ExpectedGyroCFrame = CFrame.new(Mainpart.CFrame.Position) * CFrame.Angles(math.rad(-10),0,0)
else
ExpectedSpeed = Vector3.new(0,ExpectedSpeed.Y,0)
end
if Keys.A then
local yes = Mainpart.CFrame.RightVector.Unit * Speed
--ExpectedSpeed = Vector3.new(-yes.X,ExpectedSpeed.Y,-yes.Z)
Athingy += 0.5
ExpectedGyroCFrame = CFrame.new(Mainpart.CFrame.Position) * CFrame.Angles(0,math.rad(Athingy),math.rad(12))
end
Gyro.CFrame = ExpectedGyroCFrame
game:GetService('TweenService'):Create(Force,TweenInfo.new(0.6),{Velocity = ExpectedSpeed}):Play()
-- Force.Velocity = ExpectedSpeed
end
Sorry for long code, it might be annoying to check it out.
The only trouble is at the ExpectGyroCFrame.
The trouble, is clearly.
It will make a new CFrame basing on the Position, which will always look to the front (look back to the fron always)
I want it to rotate.
But without going back to the front,
Any idea on how can I fix this?
The way it should rotate, must be X,Y,Z axis, for effects like spinning, and going forward
Gif of error: https://gyazo.com/3c99c51d7fa962d615c8441315b7c020
now, I know error, why can’t I fix it?
Because I don’t really know what to do.
The helicopter should rotate according to the look vector of it.
So, it should rotate, and than go back (when no key is pressed)
To a CFRAME according to ITS LOCAL ORIENTATION but, without rotation, I think you know what I mean, sorry for post to long.
epic 3D draws