I am working on a helicopter script right now that uses CFrame manipulation instead of roblox physics for moving it. I mostly have it working, except that when turning the helicopter, one it gets to 90 degrees it freezes up and won’t be able to go fully 360. Here is a video of the issue:
Here is the code that updates the helicopter’s cframe. This code is inside a RunService heartbeat connection:
local hCFX = hCF.X
local hCFY = hCF.Y
local hCFZ = hCF.Z
local hCFXA, hCFYA, hCFZA = hCF:ToEulerAnglesXYZ()
local pw, px, py, pz = toQuaternion(0, hCFYA, 0)
local physicalCFrame = CFrame.new(hCF.X, hCF.Y, hCF.Z, px, py, pz, pw)
local uw, ux, uy, uz = toQuaternion(0, math.rad(sideSpring:GetPosition() * dt), 0)
local updateVector = CFrame.new(0, heightSpring:GetPosition() * dt, forwardSpring:GetPosition() * dt, ux, uy, uz, uw)
local newCFrame = (physicalCFrame * updateVector)
helicopter:SetPrimaryPartCFrame(newCFrame)
Omitted is the updating of the height, forward and side springs, and also getting hCF, which is the helicopter’s primary CFrame. What should I do to fix the locking issue and make the helicopter be able to turn 360 degrees. Changing it to a Roblox physics-based option is not possible at this point.