Roy Halladay was flying dangerously close to homes -- and making wild turns and adjustments in altitude -- moments before his fatal crash ... this according to the NTSB.

The National Transportation Safety Board released the preliminary report regarding the Nov. 7 crash in Florida that killed the former MLB pitcher.

GPS data obtained from the plane shows Halladay was climbing and diving around the crash site -- and at one point, flew "as close as 75 feet to the Gulf Harbor South Beach houses."

The report also references video of Halladay's plane taken before the crash which shows the aircraft flying around 10 feet above the water. Unclear if the report is referencing the video obtained by TMZ Sports, but the description is very similar.