In part, although his primary motivation was the "impress" actress Jodie Foster who he saw in the movie. Hinckley could differentiate Jodie Foster from her character so he wasn't completely delusional. I suspect if Taxi Driver hadn't caught his interest something else would have as he had a well-documented history of mental illness before his assassination attempt on President Reagan.
https://en.wikipedia.org/wiki/John_H...Jr.#Early_life