Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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))

1 comment

0

It's no different .-. Thanks for trying :/

This discussion is preserved as it was. New answers, comments, and votes are closed.