-- Creates a lazy object-mirror for the provided part.
-- This is used to make the Head visible in first person.


function FpsCamera:AddHeadMirror(desc)
	if desc:IsA("BasePart") and self:IsValidPartToModify(desc) then
		local mirror = desc:Clone()
		mirror:ClearAllChildren()
		
		mirror.Locked = true
		mirror.Anchored = true
		mirror.CanCollide = false
		mirror.Parent = self.MirrorBin
		
		local function onChildAdded(child)
			local prop
			
			if child:IsA("DataModelMesh") then
				prop = "Scale"
			elseif child:IsA("Decal") then
				prop = "Transparency"
			end
			
			if prop then
				local copy = child:Clone()
				copy.Parent = mirror
				
				self:MirrorProperty(child, copy, prop)
			end
		end
		
		for _,child in pairs(desc:GetChildren()) do
			onChildAdded(child)
		end
		
		self.HeadMirrors[desc] = mirror
		self:MirrorProperty(desc, mirror, "Transparency")
		
		desc.ChildAdded:Connect(onChildAdded)
	end
end
