---Steering


function Steering()
		local mode=0
		
		local TUpdate=tick()
		local Steer=0
		local CSteer=0
		local CSteerTol=3
		local CSteerPerc=.3
		local CPos=0
		local KRef=0
		local KTime=1
		
		local FoAngle=math.rad(34)
		local FiAngle=math.rad(37)
		local RoAngle=math.rad(1)
		local RiAngle=math.rad(1)
		local RTime=.25
		local MWidth=400
		local MExp=2
		local KAdj=.7
		local KDecay=350
		local KDExp=1.65
		local DZone=50
		
		local CExp=2
		local CDZone=.1
		
		local function UpdateSteer()
			local fl=FoAngle
			local fr=FiAngle
			local rl=RoAngle
			local rr=RiAngle
			if CPos<0 then
				fl=FiAngle
				fr=FoAngle
				rl=RiAngle
				rr=RoAngle
			end

			for i,v in pairs(car.Wheels.FL:GetChildren()) do
				--v.Arm.Weld.C0=CFrame.new()*CFrame.Angles(0,(CPos+(CSteer*CSteerPerc))*-fl,0)
				v.Arm.Steer.cframe=v.Base.CFrame*CFrame.Angles(0,(CPos)*-fl,0)
				local look = (v.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector 
				v.Arm.Steer.MaxTorque=Vector3.new(math.abs(look.x),math.abs(look.y),math.abs(look.z))*50000
			end
			for i,v in pairs(car.Wheels.FR:GetChildren()) do
				--v.Arm.Weld.C0=CFrame.new()*CFrame.Angles(0,(CPos+(CSteer*CSteerPerc))*-fr,0)
				v.Arm.Steer.cframe=v.Base.CFrame*CFrame.Angles(0,(CPos)*-fr,0)
				local look = (v.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector 
				v.Arm.Steer.MaxTorque=Vector3.new(math.abs(look.x),math.abs(look.y),math.abs(look.z))*50000
			end
			for i,v in pairs(car.Wheels.RL:GetChildren()) do
				--v.Arm.Weld.C0=CFrame.new()*CFrame.Angles(0,(CPos+(CSteer*CSteerPerc))*rl,0)
				v.Arm.Steer.cframe=v.Base.CFrame*CFrame.Angles(0,(CPos)*rl,0)
				local look = (v.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector 
				v.Arm.Steer.MaxTorque=Vector3.new(math.abs(look.x),math.abs(look.y),math.abs(look.z))*00000
			end
			for i,v in pairs(car.Wheels.RR:GetChildren()) do
				--v.Arm.Weld.C0=CFrame.new()*CFrame.Angles(0,(CPos+(CSteer*CSteerPerc))*rr,0)
				v.Arm.Steer.cframe=v.Base.CFrame*CFrame.Angles(0,(CPos)*rr,0)
				local look = (v.Base.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector 
				v.Arm.Steer.MaxTorque=Vector3.new(math.abs(look.x),math.abs(look.y),math.abs(look.z))*00000
			end
			GSteer=CPos
		end
		
		local function getSteer()
			--local rot=(car.DriveSeat.RotVelocity*(car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector)/CSteerTol
			--local CS=rot.x+rot.y+rot.z
			--CSteer=(CS+Steer)*(1-math.abs(Steer))
			
			local SLimit=1
			if GMode==0 then
				Steer=car.DriveSeat.Steer
			elseif GMode==1 then
				--SLimit=0
				local MPos=mouse.X-(mouse.ViewSizeX/2)
				if math.abs(MPos)>DZone then
					local sPos=1
					if MPos<0 then sPos=-1 end
					Steer=sPos*math.abs(math.max(-1,math.min(1,(MPos-(DZone*sPos))/(MWidth-DZone)))^MExp)
				else
					Steer=0
				end
			else
				--SLimit=0
				if math.abs(LStickX)>CDZone then
					local sPos=1
					if LStickX<0 then sPos=-1 end
					Steer=sPos*math.abs(math.max(-1,math.min(1,((LStickX-CDZone))/(1-CDZone)))^CExp)
				else
					Steer=0
				end
			end
			
			KRef=CPos
			KTime=math.abs(KRef-Steer)*RTime
			if KTime~=0 then
				local t=math.min(1,math.min(tick()-TUpdate,KTime)/KTime)
				CPos=((KRef*(1-t))+(Steer*t))*(1-(KAdj*math.min(1,math.abs((car.DriveSeat.Velocity.Magnitude/KDecay)^KDExp),SLimit)))
			end
			UpdateSteer()
			TUpdate=tick()
		end

		--run:BindToRenderStep("Steer",Enum.RenderPriority.Last.Value,getSteer)
		--table.insert(Binded,"Steer")
		--table.insert(Binded,getSteer)
		table.insert(LoopRun,getSteer)
		
end
Steering()