“Lightyear” is not the origin story of the Buzz Lightyear toy from Pixar’s “Toy Story” series. It’s the origin story of the reason the Buzz Lightyear toy wound up in Andy’s bedroom. You see, Andy’s Mom bought a Buzz Lightyear toy back in 1995 because he was the main character in Andy’s favorite film. “This is that film,” a title card tells us before plunging us into an animated space opera starring Chris Evans as Buzz. Along the way, we’ll meet the Evil Emperor Zurg and learn where all those catchphrases folks have been saying for the past 27 years originated.

I won’t fault suspicious viewers who think this sounds like a bunch of cash-grabbing malarkey, but I should point out that this retrofitting is not without Pixar precedent. If you recall, “Toy Story 2” revealed that the Woody toy was originally a tie-in to a television show from the 1950s. Which begged the question as to why the Hell a millennial like Andy would want him. At least this time, the toy came from a contemporary reference for the kid. After seeing “Lightyear,” I was full of even more questions, such as, “Would Andy’s Mom have allowed a toy version of Buzz’s partner in her house?” And, “Come on, Andy! Why didn’t you ask your Mom for a toy version of Buzz’s cat?!”

More on the kitty cat later. “Lightyear” begins with a special mission for space rangers. Buzz is partnered with Alisha Hawthorne (Uzo Aduba), his best friend. They share in-jokes and memories of missions past. Hawthorne is a Black woman, something you don’t often see in space movies despite all that work they did for NASA in “Hidden Figures.” She constantly mocks Buzz’s penchant for “monologuing,” that is, recording the Shatner-like captain’s log into that device on his arm. Before each adventure, the duo touch fingers and yell “To infinity and beyond!” which I assume would have been the tagline for this film when Andy saw it. By that rationale, the makers of “Lightyear” can sue the makers of “Toy Story” for stealing it.

But I digress. Buzz Lightyear, the movie character, has the same penchant for being stubborn and following his own path that his toy did. This gets him in a heap of trouble when he disregards the advice of both his team and his ship’s autopilot navigator I.V.A.N. (Mary McDonald-Lewis). The turnip-shaped ship he’s flying crashes, marooning everyone on a hostile planet filled with killer vines and bugs. Guilt-ridden, Buzz makes it his mission to discover an energy source that will help them achieve hyperspace and get off the planet.

Or something like that. The most important thing to know is that every failed attempt to reach his goal results in Buzz missing four years of life back home. Everyone gets older while he stays the same age. “Lightyear” represents much of this repeated passage of time in a montage scored by Michael Giacchino; it’s reminiscent of the opening scene in “Up.” Buzz’s unwillingness to accept failure keeps him from celebrating the marriage of Hawthorne and her girlfriend, the birth of their daughter, and far too many in-jokes and experiences for him to count. When he finally achieves hyperspace, it costs him 22 more years. By this time, Hawthorne has passed on, leaving him a recorded message that Aduba delivers with such bittersweet beauty that there were audible sniffles at my screening. You’ll hear them at yours, too.

Hawthorne’s message is delivered to Buzz by her daughter, Izzy (Keke Palmer). She’s inhabiting the latest iteration of their home planet, one that’s full of hostile robots who are under the control of the suspicious “Zurg” space ship. Buzz sees a new shot at getting everyone off the planet. Unfortunately, he’s on the outs with Commander Burnside (Isiah Whitlock Jr.) the military man who used to run things, and must retrieve the turnip ship without any skilled help. Izzy offers to assist and volunteers her team of amateurs, ex-con/bomb expert Darby Steel (Dale Soules) and Mo Morrison (Taika Waititi). Their space ranger abilities are best described by Whitlock’s profane catchphrase on “The Wire.” Morrison is so bad, and causes so much trouble, that he manages to make the pig-headed Buzz look reasonable.

Director Angus MacLane and his co-writer, Jason Headley do a very good job gently mocking the type of space movie that would have existed in the 1990s. They fill “Lightyear” with details that are sure to inspire arguments on Twitter from the “Toy Story” faithful. The film’s visuals gleefully rob from other movies. I saw “Return of the Jedi,” “Avatar,” “2001: A Space Odyssey” and even “The Last Starfighter” amongst the inspirations. I.V.A.N. looks like something Nintendo would have created. Each character fits neatly into the familiar roles the genre specifies: Flawed heroes seeking redemption, rookies hoping to prove themselves, villains with secrets, and so on. The score by Michael Giacchino is one of his best, a delectable spoof of bombastic space movie music that elevates every scene it plays under.