I would use invisible objects on the sides of the screen and use them to see if the object is within those bounds. (Put them around the screen)