“Guardians of the Galaxy” takes audiences on a cosmic carpet ride into the farthest reaches of the Marvel universe, with its story of an unlikely team of interstellar heroes who band together to stop a supervillain from achieving his genocidal aims. But for Zoe Saldana, who plays the resourceful assassin Gamora — known in comic book lore as the most dangerous woman in the galaxy — the role was one rooted in earthbound inspiration.

The former dancer developed the character’s physicality after watching footage of a bullfighter and deciding that she should move gracefully, with elegant precision. Grappling with the trauma of Gamora’s past, however, led Saldana in another direction.

The green-skinned alien is the last surviving member of her race, an orphan who was trained to be lethal by her adopted father Thanos (Josh Brolin), and her plight reminded Saldana of the unspeakable horrors experienced by the child warriors in Sudan.

“Art has to imitate life, at least the art I want to be involved in,” the actress said. “There’s so many things that you take as an inspiration whether they’re good or bad…. That’s who she is, that’s who we would compare her to if she were human. It’s not something I have to see with levity — that’s up to [director] James Gunn to edit and make it really light and PG-13-appropriate, but I have to take my character seriously. What’s happened to her is real.”

From its inception, “Guardians,” which opens in theaters Friday, was designed to be something different from the other comic book blockbusters Marvel has produced since 2008’s “Iron Man,” most of which take place on Earth and feature recognizably human characters. The $170-million movie is the studio’s 10th release but the first wholly “cosmic” adventure — bringing to the screen a corner of the Marvel universe that has long been fertile creative ground for comic-book writers and artists but had been only briefly referenced in earlier hits, including “The Avengers.”

The story, rooted in a 2008 series written by Dan Abnett and Andy Lanning, follows Chris Pratt’s scofflaw Peter Quill, who finds himself hunted by an aristocratic outer-space bad guy named Ronan the Accuser (Lee Pace) after he comes into possession of a mysterious orb. Before long, he befriends misfits that include Gamora, Dave Bautista’s Drax the Destroyer, along with raccoon Rocket and his pal Groot, voiced in the movie by Bradley Cooper and Vin Diesel, respectively, who ultimately join forces to try to put an end to Ronan’s sinister aims.

Saldana said she initially had some trepidation about playing Gamora, having already had starring turns in James Cameron’s blockbuster “Avatar,” as Neytiri, and in J.J. Abrams’ two “Star Trek” films as Uhura (her filmography also includes last year’s acclaimed drama “Out of the Furnace,” and Steven Spielberg’s 2004 dramedy “The Terminal”).

J.J. Abrams and Zoe Saldana on the set of “Star Trek.” (Paramount Pictures)

“I was hesitant,” the actress said in an interview earlier this month. “I was like, I don’t really want to do another science-fiction movie because people love to typecast me — or anybody — and they’ll just say, oh, I’m just a sci-fi person. At the same time, it was a great filmmaker, a great studio, a great cast of underdogs but brilliant actors. I thought I would be foolish to pass on this opportunity out of fears of what others may think. It’s just not who I am.”

Part of the appeal, Saldana said, was portraying someone so different from herself and channeling a different kind of energy.

“Gamora, she’s not feminine in the typical sense of how women are supposed to be,” Saldana said. “I feel like she has to melt that ice for you to find that little girl in there. She’s very tough, she’s able to relate to the hard talks of it all. When Quill comes at her with that luscious, ‘Hey baby’ [attitude], I’m pretty sure she’s throwing up in her mouth. I liked that, and I thought, ‘OK, that’s something I can incorporate of myself and just shave off a little bit of my femininity.’ Even though I like to believe I’m a tomboy, I’m very feminine, so I just always have to de-train myself and allow my masculinity to seep through because Gamora is much more masculine than I am.”

Shooting the film last year in London, Saldana said she developed a strong rapport with Gunn, and that as a creative team, they developed a healthy back-and-forth.

“He challenges you in all the right places,” the actress said of Gunn. “It’s good to collaborate with him because it’s a very passionate relationship that you start to have with your director. He’s passionate about what he believes in and what he loves and so are you, but it never felt like a struggle. It always felt like a very harmonious adventure to get the best result and that’s how we all sort of were. Sometimes he’s very specific about what he wants and that’s a great thing, and sometimes it wouldn’t make sense to me and he’d have to explain it to me and he was always willing to do that, as opposed to [saying], ‘Just do it.’ I won’t ‘just do’ anything.”

Karen Gillan, who plays Gamora’s adopted sister Nebula in “Guardians,” said she developed a healthy admiration for Saldana’s natural athleticism during their scenes together, which includes one particularly physical turn.

“We do some girl fighting,” Gillan said in an interview with Hero Complex earlier this year. “She’s amazing at that stuff, like nothing I’ve ever seen. I feel like I learned so much just watching what she did. She’s so amazing with the camera. She knows how to work with the camera really well just in terms of looks and things.”

“Guardians” is on track to earn at least $65 million in its opening weekend at the box office, and early reviews have been overwhelmingly positive — which perhaps helped convince Marvel to already announce the sequel, which is set to open July 28, 2017.

Saldana confirmed that she’s on board for future adventures.

“I think they got me for a couple more years,” she said with a smile. “The whole coming together with Marvel and ‘Guardians of the Galaxy’ felt very easy. This was sort of meant to be.”