function CharacterRealism.AddMotor(o,U,A)local K=A.Parent if K and K.Name=="\072\101\097\100"then K.CanCollide=false end Util:PromiseValue(A,"\065\099\116\105\118\101",function()local o={Motor=A,C0=A.C0}Util:PromiseChild(A.Part0,A.Name.."\082\105\103\065\116\116\097\099\104\109\101\110\116",function(U)if U:IsA("\065\116\116\097\099\104\109\101\110\116")then o.Origin=U o.C0=nil end end)local K=A.Part1.Name U.Motors[K]=o end)end
-- Register's a newly added Motor6D
-- into the provided joint rotator.

function CharacterRealism:AddMotor(rotator, motor)
	local parent = motor.Parent

	if parent and parent.Name == "Head" then
		parent.CanCollide = false
	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
