This paper presents a novel approach that combines mixed reality technology with variable impedance control to enhance the collaboration between humans and robots. The HoloLens 2 mixed reality headset is used to collect task-related information, such as goal positions and environment mapping. This spatial information is then used to calculate a distance field, which provides precise distance measurements from any position to the nearest object in the environment. The proposed method focuses on adjusting impedance parameters, including damping and stiffness, based on the generated distance field. By incorporating this environmental information, the proposed method improves the operational performance of human-robot collaborative tasks. Moreover, the use of HoloLens 2 mixed reality capabilities allows the proposed method to be effortlessly applied to new environments or goals. Experimental validations were conducted using a 7-degree-of-freedom (7DOF) robot, demonstrating the effectiveness of the proposed method in enhancing human-robot collaboration.