From Seth MacFarlane's perspective, getting NFL star Tom Brady to do a cameo in "Ted 2" was a no-brainer, the casting equivalent of having a receiver wide open in the end zone.

Early in the process of writing the comedy sequel, MacFarlane knew he wanted the foul-mouthed, pot-smoking teddy bear and his best friend John (Mark Wahlberg) to try to steal someone's sperm so Ted and his human wife could have a baby. Who would that ideal unwilling donor be? For MacFarlane, the answer was clear: "Logically," he says, "for two guys from Boston, Tom Brady would be at the top of the list."

The fact that Wahlberg was friends with the New England Patriots quarterback — and that Brady had once done a cameo on MacFarlane's animated TV series "Family Guy" — made the choice that much easier. Though the prospect of being the focus of a raunchy set piece in an R-rated comedy might have made some athletes uncomfortable (these people are on Wheaties boxes, after all), MacFarlane says, "We figured we had a good shot with Tom."

Brady is hardly the only professional athlete getting drafted into movies.

In July, retired New York Giants defensive end Michael Strahan will strip down for a cameo in "Magic Mike XXL," while Cleveland Cavaliers star LeBron James will show off his comedy chops opposite Amy Schumer and Bill Hader in director Judd Apatow's new film, "Trainwreck," playing himself as the sensitive, "Downton Abbey"-loving friend of Hader's sports physician.

Athletes have, of course, popped up in movies and television for decades, whether it was Joe Namath on "The Brady Bunch," Brett Favre in "There's Something About Mary," Derek Jeter on "Seinfeld" or Mike Tyson in "The Hangover." Occasionally a whole movie has been constructed from the ground up as, essentially, one gigantic athlete cameo — think Michael Jordan teaming up with Bugs Bunny in "Space Jam" or, less successfully, Shaquille O'Neal as a 5,000-year-old genie in "Kazaam."

Professional athletes have been courted by Hollywood. Some athletes successfully make the transition to film and TV; others leave movie sound stages in defeat. Here's a look at some pro athletes brave enough to test Hollywood waters.

In recent years, though, as social media have made stardom an increasingly transferable commodity, the already blurry line between sports and entertainment has become more permeable than ever.

"Celebrity has become ubiquitous, and everyone touches the globe now," says "Ted 2" producer Scott Stuber. "These sports stars transcend just athletics. They host 'Saturday Night Live.' They do television commercials. They're seen at the Met Gala with their wife, tuxed up and looking like a movie star."

For some athletes, showing up for a quick scene in a movie is simply a lark or an easy way to enhance their personal brand. For others, it's an opportunity to lay the groundwork for a future outside of sports, no small thing in a field where careers often peter out once athletes hit their 30s.

Ultimate Fighting Championship fighter Ronda Rousey, who has acted in the action sequel "Furious 7" and the comedy "Entourage," has stated that she wants to pursue acting full time once her fighting career ends, following a trajectory that Dwayne Johnson, who started as a pro wrestler, made earlier.

"There is certainly aspiration for a lot of athletes to cross over and do this for their own business," says one agent who works with several high-profile athletes. "It's not just a hobby: 'Come hang out and do some funny lines.' There are only a handful of athletes it really works for, where when their helmet comes off you still know who they are. But when the worlds collide and it makes sense, it's great."

For athletes unaccustomed to performing on camera, an acting coach can be a lifesaver. But for many, like Brady — who shot his part in "Ted 2" on a three-hour break from training camp — the transition from the field or court to the screen seems relatively effortless.

"Professional athletes have to be showmen in some ways," says MacFarlane. "Tom is a born performer. He was able to get the joke from the outset and sell it very convincingly."

In writing the script for "Trainwreck," Schumer admits she incorporated James into it because, as a non-sports fan, he was pretty much the only basketball player she could think of.

"I'll hear a team and I'm, like, 'Is that hockey? Is that baseball?' I have no idea," she says. Fortunately, James — who has launched his own production company, Spring Hill Productions, to develop TV and digital projects — was completely game.

"I think he just likes comedy and wanted to play with us," Schumer says.

When James showed up to shoot his part, Schumer didn't know what to expect.

"We would never ask him to audition," she says. "We were just, like, 'Please, please show up on the days you're supposed to.' We didn't think about his acting until he was on set. We were, like, 'Thank God he can act!'"

Schumer and Apatow were savvy enough to know that bringing James into the movie — along with Dallas Mavericks star Amar'e Stoudemire and pro wrestler John Cena — could help broaden out what might otherwise by the typical female-skewing audience for a romantic comedy.

Similarly, the makers of "Pitch Perfect 2" were hopeful that getting the Green Bay Packers to sing and dance in the film could help draw more men to the theaters.

"We knew there were a lot of men who were fans of the first movie," says Max Handelman, who produced both "Pitch Perfect" films. "So we thought, 'What better way to acknowledge that head-on than to put five pro football players into our movie, embracing and loving singing a cappella as much as the girls do?' "

The players' scene was even showcased in a trailer during the Super Bowl, months before the movie opened.

"I 100% believe that featuring the Packers as prominently as we did was a driver for men to come check out the movie," Handelman says.

Still, incorporating athletes into a movie can sometimes come with unforeseen complications, as MacFarlane discovered. Months after filming the cameo on "Ted 2," Brady became embroiled in the controversy over deflated footballs known as Deflategate.

The director knew the film needed to address the flap in some way. "It felt like it was being talked about so much that it would be conspicuously absent," he says. So during post-production he had Wahlberg loop in a new joke.

Out of all the possible sports scandals out there, MacFarlane knows how lucky he was to have one that lent itself so easily to one more crude punchline.

"Given what some of those guys are up to," he says with a laugh, "we were in the shallow end of the pool."