function init()
	targetJoints = FindJoints("targetJoints", true)
end

function tick()
	for i=1,#targetJoints do
		local j=targetJoints[i]
		local spd=tonumber(GetTagValue(j, "targetJoints")) or 2
		SetJointMotor(j, spd)
		-- DebugWatch(j, spd)
		if GetJointType(j)=="prismatic"then
			local min,max=GetJointLimits(j)
			local jM = GetJointMovement(j)
			if jM-.05<min then
				SetTag(j, "targetJoints", -math.abs(spd))
			elseif jM+.05>max then
				SetTag(j, "targetJoints", math.abs(spd))
			end
		end
	end
	
end