Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Something wrong with this equation for plane Banking? [Unsolved]

Asked by 10 years ago

The script works, thing is, when you steer left, then go all the way right (Vise versa), as the plane gets to the straight position it rotates on the parts Y axis causing the nose to go up (Which isnt in the script .-.). Anyone got an idea or solution?

local maxBank = 90
local gyro = game.Players.LocalPlayer.Character.Real.Main.Gyro
        local bank = ((((m.ViewSizeX/2)-m.X)/(m.ViewSizeX/2))*maxBank)  --Some value here prolly?
        bank = (bank < -maxBank and -maxBank or bank > maxBank and maxBank or bank)
            gyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
            gyro.cframe = (m.Hit*CFrame.Angles(0,0,math.rad(bank)))

1 answer

Log in to vote
0
Answered by 10 years ago

OK! Your problem is that you need to rotate based on the lookVector of the plane, so that it rotates based on the direction of the plane AND the banking -- set the bodyGyro CFrame to this:

local gyro = game.Players.LocalPlayer.Character.Real.Main.Gyro
bank = (bank < -maxBank and -maxBank or bank > maxBank and maxBank or bank)
gyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)

gyro.cframe = m.Hit*CFrame.new(gyro.Parent.CFrame.lookVector) * CFrame.Angles(0, 0, math.rad(bank))
0
It's no different .-. Thanks for trying :/ Orlando777 315 — 10y
Ad

Answer this question