LOS ANGELES , California ( CNN ) -- Jamie Foxx suffered through his own psychological turmoil while plunging into the role of a mentally ill musician in `` The Soloist , '' the actor said . Jamie Foxx plays mentally ill musician Nathaniel Ayers in `` The Soloist . '' Foxx , 41 , revealed that his bond with Nathaniel Ayers was close because of his own yearlong battle two decades ago -- triggered when `` somebody slipped me something in college and I lost my mind . '' `` The Soloist , '' based on a true story , tells how Los Angeles Times columnist Steve Lopez , played by Robert Downey Jr. , discovered the homeless Ayers and helped the former music prodigy , who has schizophrenia . The movie comes out Friday . Foxx , who won an Oscar in 2005 for his portrayal of music legend Ray Charles , said he consulted a psychiatrist because he feared what would happen as he took on Ayers ' personality . `` I asked very foolishly , 'Can I catch schizophrenia ? ' and he says , 'No , you ca n't catch schizophrenia . ' `` The doctor warned him he could experience post-traumatic stress , Foxx said . The Los Angeles Times reported that Foxx suffered `` panic attacks and bouts of paranoia '' during filming . Foxx told of one early morning incident when he got so far into Ayers ' character that he called his manager and said , `` I know why Nathaniel does this and I 'm him ! '' `` I explained what I was feeling to him and he said 'Foxx , you 're not Nathaniel , ' `` he said . Foxx said he had `` a childhood fear of going crazy . '' `` There was a sanitarium in my hometown in Terrell , Texas , called the Terrell State Hospital , and when we would visit I would go , ' I hope that never happens to me , ' `` he said . He left Texas after high school to attend college on a music scholarship in San Diego , California . `` When I was 18 , somebody slipped me something in college and I lost my mind and they had to take me to the hospital , '' Foxx said . `` For 11 months it was tough . '' Another student served as his `` angel , '' just as Lopez helped Ayers , Foxx said . `` He 'd say , 'You 're good , you 're not crazy , everything is fine , I 'm here with you . ' `` Just as Ayers used a cello for comfort , Foxx would use the piano . `` I would play my music to sort of like soothe it , '' Foxx said . His `` bad trip '' subsided after almost a year , but Foxx said he drew on the experience to understand Ayers . `` We had a marriage , myself and Nathaniel , '' he said . `` Here 's a person who happened to be great playing the cello . He happened to go to Juilliard . He happened to go to L.A. , become homeless and run into his angel , Steve Lopez . '' Ayers still lives in Los Angeles and is working part-time as a janitor . The exposure to people who lived on the streets of Los Angeles taught Foxx a positive lesson , he said . `` We had a ball with them , '' he said . `` They love to dance , they love to talk trash . ... They actually had a life . People were smiling and enjoying their lives . '' The Oscar buzz is again building for Foxx , who is firmly established as master of the biopic . He said he and his management have `` carved out our own niche . '' `` They found this beautiful story , which paralleled my life a little bit , '' he said . Foxx said he 's `` got his fingers crossed '' that he will be able to someday bring the character of former heavyweight boxing champ Mike Tyson to the big screen . `` I think there 's a beautiful story in it , not like Ali , '' he said . `` Ali was a story of yesterday when our heroes were heroes , '' he said . `` This is a different type of hero story . It 's a story of today . It 's tragedy . It 's a triumph . It 's all of it put together . '' CNN 's KJ Matthews contributed to this story .
Jamie Foxx plays mentally ill homeless man in `` The Soloist '' Foxx was frightened by experience : He had `` childhood fear of going crazy '' When he was 18 , someone slipped him `` something '' and Foxx ended up in hospital .