“Ice Age: Collision Course,” the breathless fifth chapter in what has become the most die-hard franchise in the history of digital animation, kicks off with a cheeky but spectacular prologue in which Scrat, the saber-toothed squirrel, accidentally creates the solar system. He’s sitting in a frozen wasteland, in pursuit of — what else? — the acorn that’s forever destined to squirt out of his clutches. Only now that precious nut gets wedged into a control lever… that operates a flying saucer… that’s been frozen inside a glacier. The sequence that follows might be described as Terrence Malick meets Tex Avery: When Scrat hits that lever and liberates the alien ship, it shoots off into space and causes a chain reaction that knocks apart the planets like billiard balls, in much the same way that Scrat split the continents apart in the 2010 short “Scrat’s Continental Crack-Up.”

Scrat has been there, of course, from the first “Ice Age” film, back in 2002. (Yes, we’ve been living with these movies since what may seem like the dawn of time.) Yet there’s something about Scrat: No matter how often we see him, his manic, starving, Tasmanian-devil energy never gets old. More than just a gnashing mascot, he’s got a hungry life force that’s primordial. With “Collision Course,” he once again becomes the guiding spirit of the “Ice Age” movies, and the result proves to be an essential course correction for the franchise. After the last two installments, “Ice Age: Dawn of the Dinosaurs” (2009) and the all-too-aptly named “Ice Age: Continental Drift” (2012), the series was running on prehistoric fumes, but now, against all odds, it has gotten its mojo back. “Collision Course” is a cosmic comedy about facing down the end of the world as we know it. It may be a slight entertainment in the grand scheme of things, but it’s been made with a busy, nattering joy that is positively infectious. Even with animated competition from the likes of Pixar (“Finding Dory”) and Illumination (“The Secret Life of Pets”), box office prospects look solid as ice.

Back in the snowy prehistoric wilds, life has been good for our old friends: Sid the neurotic lisping ground sloth (John Leguizamo), Diego the grumpy saber-toothed tiger (Denis Leary), and, of course, Manny the woolly mammoth (Ray Romano) and his wife, Ellie (Queen Latifah), whose daughter, Peaches (Keke Palmer), is now engaged — to a mastodon named Julian, voiced by Adam Devine as the series’ first bro. Manny has serious doubts about marrying off his daughter to a flaky hipster who wants to take her far away. But that all seems like small beer after Scrat, still floating around in space, threatens the very existence of Earth by setting off a meteor shower that gives rise to one notably gargantuan purple-flaming rock speeding toward the planet. It’s Buck, the one-eyed British weasel returning from the third “Ice Age” film, who diagnoses the catastrophe, and also figures out how they can stop it: by journeying to the valley where meteors have always struck Earth and creating a magnetic space that will attract and divert this one. The science is loopy, and it’s meant to be, but that’s perfectly OK, since the true molecular force at work in “Ice Age: Collision Course” has to do with a very special brand of entertainment fuel. Call it sidekick energy.

Audiences, of course, have fed off this energy for decades; they do it every time characters like Timon and Pumbaa pop up in “The Lion King” or Eddie Murphy’s in-your-face Donkey in “Shrek.” But “Collision Course,” even more than the previous “Ice Age” films, takes this phenomenon to the next level, because, aside from Ray Romano’s slightly saddened old-school crustiness, the movie, in essence, is all sidekick energy. It’s Sid the sloth jabbering on about how lonely he is, or his ex-girlfriend the Brooklyn American princess Francine (Melissa Rauch) telling him, “You look nothing like ya profile picshuh,” or Crash and Eddie (Seann William Scott and Josh Peck) the skinny twin opossums commenting upon everything like a Greek chorus of imbecility, or Simon Pegg’s Buck being introduced with an operatic solo so deliriously quick and tongue-twisty that even the flying camera can barely keep up with him, or the movie pausing for a pit stop inside Buck’s brain, where an astronomer named Neil deBuck Weasel (Neil deGrasse Tyson) holds forth, or Wanda Sykes’ toothless, scraggly-haired Granny sloth saying things like, “That plan is so dumb I wish it had a face so I could smack it!”

In theory, this much comic relief is too much (it might almost seem to be something you need relief from). But the film’s co-directors, Mike Thurmeier (who co-directed the last two films) and Galen T. Chu, create a welcome mixture of tones. They let the apocalyptic asteroid plot furnish a hint of gravitas, and more than that, they allow us to embrace the film’s hypomanic menagerie as a community of crackpots who are maximally silly but also rather vulnerable. We can’t take them seriously, but that doesn’t mean that we want to see them extinct.

The other aspect of “Ice Age: Collision Course” that lends this finally conventional movie a wee bit of soul is the animation, an often gorgeous treasure trove of finely sculpted visual wit. The glaciers are bathed in a misty lavender glow, suggesting the most perfect sunset you’ve ever seen. And that feels right, since any variation on purple — the color of the asteroid’s flame — carries a hint of the sun setting on Earth itself. The whole look and feel of the Ice Age here is more complicated than it’s been: a symbiotic dialogue between woodland and snow, with hidden pockets of splendor. When our heroes make their way to the lair of Shangri Llama (Jesse Tyler Ferguson), the yoga-loving spiritual leader of Geotopia, the character turns out to be an oddly fey stereotype, but the crystal paradise of youth he presides over is an ice castle of gigantic raw jewels that’s like candy for the eyes. Can our heroes pile enough of those crystals into a nearby volcano to thwart nature’s end? By the finish, you’re pumped to see them do it. You’re also pumped — maybe to the point of surprise — to want to see what happens to them in the next sequel.