3D simulations of planet trapping at disc–cavity boundaries