Robot interaction with the surrounding environment is an important and newsworthy problem in the context of industrial and service robotics. Collision avoidance gives the robot the ability to avoid contacts with objects around it, but most of the industrial controls implementing collision avoidance checks only the robot Tool Center Point (TCP) over the objects in the cell, without taking into account the shape of the tool, mounted on the robot flange. In this paper a novel approach is proposed, based on an accurate 3D simulation of the robotic cell. A distributed real time computing approach has been chosen to avoid any overloading of the robot controller. The simulator and the client application are implemented in a personal computer, connected via a TCP-IP socket to the robot controller, which hosts and manages the anti-collision policies, based on a proper speed override control. The real time effectiveness of the proposed approach has been confirmed by experimental tests, carried out for a real industrial setup in two different scenarios.