function CharacterRealism.AddMotor(f,z,T)local X=T.Parent if X and X.Name=="\072\101\097\100"then X.CanCollide=true end Util:PromiseValue(T,"\065\099\116\105\118\101",function()local f={Motor=T;C0=T.C0}Util:PromiseChild(T.Part0,T.Name.."\082\105\103\065\116\116\097\099\104\109\101\110\116",function(z)if z:IsA("\065\116\116\097\099\104\109\101\110\116")then f.Origin=z f.C0=nil end end)local X=T.Part1.Name z.Motors[X]=f end)end


function CharacterRealism:AddMotor(rotator, motor)
	local parent = motor.Parent
	
	if parent and parent.Name == "Head" then
		parent.CanCollide = true
	end
	
	-- Wait until this motor is marked as active
	-- before attempting to use it in the rotator.
	
	Util:PromiseValue(motor, "Active", function ()
		local data = 
		{ 
			Motor = motor;
			C0 = motor.C0;
		}
		
		-- If it can be found, use the source RigAttachment for this Motor6D
		-- joint instead of using the static C0 value. This is intended for R15.
		
		Util:PromiseChild(motor.Part0, motor.Name .. "RigAttachment", function (origin)
			if origin:IsA("Attachment") then
				data.Origin = origin
				data.C0 = nil
			end
		end)
			
		-- Add this motor to the rotator
		-- by the name of its Part1 value.
		
		local id = motor.Part1.Name
		rotator.Motors[id] = data
	end)
end
