--[[
    Configures the avatar's Humanoid physics to ensure they do not clash with the vehicle
]]

function ClientAvatarComponent:configurePhysics()
	local humanoid = self.avatar:FindFirstChildOfClass("Humanoid")

	-- By disabling HumanoidStateTypes, we stop the Humanoid automatically entering them
	for _, stateType in pairs(Enum.HumanoidStateType:GetEnumItems()) do
		if stateType ~= Enum.HumanoidStateType.None and stateType ~= Enum.HumanoidStateType.Physics then
			-- Pcall here as some state types are not intended to be disabled
			pcall(
				function()
					humanoid:SetStateEnabled(stateType, false)
				end
			)
		end
	end

	-- When in the 'Physics' state the Humanoid has no physics influence of its own
	humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, true)
	humanoid:ChangeState(Enum.HumanoidStateType.Physics)

	-- To minimize impact on driving, make all the parts massless and non-collidable
	for _, descendant in pairs(self.avatar:GetDescendants()) do
		if descendant:IsA("BasePart") then
			descendant.Massless = true
			descendant.Anchored = false
			descendant.CanCollide = false
		end
	end
end

function ClientAvatarComponent:updateStatus(statuses)
	-- TODO: Steering animation
end
