Move this into it's own block since it only needs to run if the nearest object is currently selected & active.