Kevin Costner recalled how he powered through filming his 2016 movie "Hidden Figures" despite a debilitating health condition. 

During a cover interview with People magazine, the 69-year-old actor opened up about struggling while shooting the biographical drama in the spring of 2016.

"I've never worked drunk on a set. I've never worked high on a set. But I was on morphine the last two weeks that I worked on ['Hidden Figures']," Costner said.

"I had kidney stones, and I worked 10 days under an [IV] drip. I don't even know how.

‘HORIZON’ DIRECTOR KEVIN COSTNER GRATEFUL ‘GOD ALLOWED’ HIM TO MAKE EPIC MOVIE DESPITE MASSIVE PERSONAL RISKS

kevin costner close-up

Kevin Costner revealed he was on a morphine drip after developing kidney stones while filming "Hidden Figures." (Cindy Ord/Getty Images)

"About three days of it I was normal, and then something happened to me," he recalled. "I didn't miss a day at work. I've never missed a day at work. And then when I thought I was going to be off [the morphine], a second kidney stone came, which I never had, and I was right back on it.

"So I sat in my trailer with a morphine drip in my arm."

"Hidden Figures," which is loosely based on Margot Lee Shetterly's 2016 non-fiction book of the same title, followed three Black female mathematicians — Katherine Goble Johnson (Taraji P. Henson), Dorothy Vaughan (Octavia Spencer) and Mary Jackson (Janelle Monáe) — whose work at NASA led to the successful launch into orbit of astronaut John Glenn and propelled the United States ahead of the Soviet Union in the Space Race.

LIKE WHAT YOU’RE READING? CLICK HERE FOR MORE ENTERTAINMENT NEWS

Janelle Monae, Taraji P. Henson; Kevin Costner and Octavia Spencer

Janelle Monáe, Taraji P. Henson, Kevin Costner and Octavia Spencer in the 2016 movie. (Michael Stewart/Getty Images)

Costner played the fictional character of Al Harrison, the director of NASA's Space Task Group. While speaking with People, Costner revealed the visible bruising he experienced from the IV treatments affected his wardrobe choices in the film.

"I eventually had to have my sleeves down in the movie as opposed to rolled up because of that," Costner said. "I wanted to cry, but there was everybody watching, so I didn't."

Directed by Theodore Melfi, "Hidden Figures" was a box office success and earned three Oscar nominations, including best picture, best supporting actress for Spencer and best adapted screenplay.

Costner recalled that he teamed up with Melfi to develop the character of Al Harrison, who was based on three different real-life people. 

"It's one of the greatest experiences I've had," he said of the collaboration. "Working with Ted, it was magic. He trusted me so much."

Kevin Costner, Taraji P. Henson, Ted Melfi and Octavia Spencer

The actor said working with director Theodore Melfi was "magic." (Kris Connor/Getty Images for Academy of Motion Picture Arts and Sciences)

The first movie in Costner's four-part post-Civil War drama, "Horizon: An American Saga," arrived in theaters Friday. 

"Horizon" stars Costner, who also wrote and directed the four films. The actor backed the saga with his own money, calling it a passion project from nearly 30 years ago.

"I know they say I've got $20 million of my own money in this movie," he previously told GQ magazine. "It's not true. I've got now about $38 million in the film. That’s the truth. That’s the real number."

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

Kevin Costner wore a tan suit and brown loafers as he posed for photos at the US Premiere of "Horizon: An American Saga - Chapter 1."

The first movie in Costner's four-part post-Civil War drama, "Horizon: An American Saga," arrived in theaters Friday.  (Frazer Harrison/Getty Images)

However, Costner recently told Entertainment Weekly he isn't stressed as he anticipates the movie's opening weekend box office numbers.

CLICK HERE TO GET THE FOX NEWS APP

"I've lived with movies and what happens to them on their opening weekend," the "Yellowstone" alum said. "If we put so much pressure on that, we're bound to be disappointed. I'm really happy that ‘Horizon’ looks like what it's supposed to look like, and that's the way it'll look the rest of its life. And that's really important to me in this process.

"Would I love that it would be highly, highly successful? Of course, I'd like that. My ego would like that; everyone would like that. But I am happiest that the movie that you and I are talking about looks the way I want it to look."