-- Drive Input Loop --

while true do
	getInputValues(MobileHandbrake)

	local currentVel = Chassis.GetAverageVelocity()
	
	-- Taking care of steering
	-- For debugging, calculating steering paramters with SteeringCalculations script
	-- local steer = script.Parent.SteeringValue.Value
	-- steering.TargetPosition = -steer * steerMax
	-- Steering is more sensitive at small value
	local steer = script.Steering.Value
	Chassis.UpdateSteering(steer, currentVel)
	
	
	-- Taking care of throttling
	local throttle = script.Throttle.Value
	script.AngularMotorVelocity.Value = currentVel
	script.ForwardVelocity.Value = driverSeat.CFrame.LookVector:Dot( driverSeat.Velocity )
	Chassis.UpdateThrottle(currentVel, throttle)
	
	-- Taking care of handbrake
	if script.HandBrake.Value > 0 then
		Chassis.EnableHandbrake()
		steer = script.Steering.Value --TODO: Fix handbrake steering
	end