This paper centers on a human avoidance algorithm designed to enhance the coexistence of humans and robots within industrial settings. While both humans and robots share a workspace, it is crucial to ensure the robot operates seamlessly without encroaching upon the human’s space. However, human space is not static and therefore robots need to adapt in real time to changes. The proposed approach involves employing a depth camera to actively identify and track humans in real time. It determines the distance between the human and the robot’s end effector and computes a repulsive vector. At the same time, an attractive vector is calculated from the robot end effector towards the target pose. Based on the addition of the repulsive and attractive vectors, a new trajectory for the robot is calculated, keeping the same goal pose. This enables the robot to steer clear of potential collisions while achieving its goal. Human detection is facilitated using an Astra Pro depth camera from Orbbec. We demonstrate this algorithm on the UR5 robot from Universal Robots which it is tasked with moving at a velocity of 0.1 m/s towards predefined targets. The avoidance algorithm remains constantly active, ensuring continuous trajectory for the robot post-avoidance of the human presence.