Hello,
I am having two glitches with a helicopter system of mine. The helicopter is meant to tilt right/left when it is rotating right/left, and tilt slightly forward or backward, depending on which direction is being flown. The rotating and the tilting while rotating work beautifully, but there are some other issues…
-
One of the first issues it has is, when you start it up/first get into it, it immediately rotates to the right, instead of sticking forward to the direction it was pointed in, like seen here:
This is relatively minor, but it is something I would like to fix. Does anyone know how? -
The second glitch is more detrimental to the helicopter system. Basically, when the helicopter goes forwards/backwards in its initial flight path, the tilting works fine, but when you start rotating it, the forward/backward tilt gets reversed, or starts being applied to axes that it should not be applied to. If you move back to the original axis, it recorrects itself… It’s very odd. Here is a video that shows this
Here is the relevant snippet(s) of code:
---the following are variables/lines declared/executed outside of the main loop that controls helicopter movement.
local heli = script:WaitForChild("heli",5)
local engine = heli.Value.colors.Engine
local seat = heli.Value.VehicleSeat
engine.AlignOrientation.CFrame = engine.CFrame
local angle = 0
---the below lines of code are executed inside a RenderStepped event which is effectively a loop
angle += -seat.Steer
engine.AlignOrientation.CFrame = engine.AlignOrientation.CFrame:Lerp(CFrame.fromEulerAnglesXYZ(-seat.Throttle*math.rad(5), math.rad(angle), -seat.Steer*math.rad(15)),.5)
--- above (intended) axes go as such ( forward/backward tilt, turning/rotating of heli, right/left tilt that comes with turning/rotating)
Can anyone help me with these two issues?