Jim Carrey Pens Children's Book Partly Based on His Childhood Fears

No one inhabits a character quite like Jim Carrey, the actor who has starred in memorable hits including "Ace Ventura: Pet Detective," "The Mask" and "Bruce Almighty."

Now, the actor is taking on a new, off-screen role: children's author.

Carrey, 51, has just penned his first children's book. "How Roland Rolls" tells the story of a wave named Roland who wonders whether his life will end when he hits the beach. Roland eventually realizes that he's not just one wave, but is actually the entire ocean. The story is intended to show humanity's interconnectedness through the metaphor of a wave in the ocean.

Carrey talked to ABC News' Bianna Golodryga about why he wrote the book.

'In Living Color' Cast: Where Are They Now?

"I remember, when I was a kid, I had real fears about - my parents were smokers - I remember locking myself in the bathroom one day for hours with their carton of cigarettes because I was afraid they were going to die. … Kids have real fears about life and what's going to happen to mom and dad," he said. "I wanted to give them something that reassures them that no one is going anywhere."

The story may partly be based upon Carrey's memories of childhood fears, but the idea of writing the book was rooted in Carrey's memories of bedtime stories with his father. They were some of Carrey's happiest times as a child.

"There is a moment where if you bring everything down and make everything quiet and share a book together, it's really a special thing … it's magical, it really is a miracle. It's kind of heaven," he said.

The actor dedicated the book to his 3-year-old grandson, Jackson, and said he's excited to be able to read the book to the child.

WATCH: Jim Carrey Protests Violence in His Own Movie

Carrey also was involved in the book's illustrations. Using his own facial expressions as inspiration, Carrey drew the initial sketch of Roland, and he collaborated with his daughter, Jane, who composed the music for the e-book.

Asked whether writing the book had fulfilled him as a grandfather, Carrey said it had.

"It really feels good that I'm doing something for that purpose to hand down to my family," he said.