Nearly all of the roughly 300 so-called extrasolar planets discovered to date have been detected using indirect methods such as changes observed in a star when a planet orbits directly in front of it from the perspective of Earth .