How many times as a parent have you looked at your child and thought: “What is going on inside that kid’s head?”

Inside Out, the next release from Pixar that opens June 19, takes that question to heart. It tells the tale of what’s happening both inside and outside the mind of 11-year-old Riley, a tween who finds herself on an emotional rollercoaster when her family is uprooted from the midwest to San Francisco.

Last week at Pixar headquarters in Emeryville, Ca., the filmmakers offered a sneak peek at almost an hour of the film. It was both bittersweet and funny, and there were audible sighs of dismay when the lights went up, leaving everyone clamoring for more. During a roundtable discussion the next morning, director Pete Docter and producer Jonas Rivera talked about how their own experiences and emotions helped shape the film.

“I don’t think this movie would exist if I wasn’t a parent,” said, Docter, who explained that much of Riley is based on the changes he saw in his own daughter, Ellie, now 16. “Watching my daughter grow up also sparked memories of my own childhood. It’s given us a personal connection to the story. When you feel something deeply, it will show up in little, almost invisible ways in timing and reaction.”

In the movie, Riley struggles with missing old friends, making new ones and the general torments of life in middle school. Meanwhile, in a parallel story inside the mind, her emotions work overtime, trying desperately, and comically, to maintain the happy, carefree Riley they have co-existed with since birth. But as Riley heads into the storm of adolescence, all bets are off.

“The minute he pitched this idea of his daughter changing, I was like, ‘yes!’ I’m right behind you,” said Rivera. “My daughter’s nine, and I thought: everyone’s either had a kid or been a kid so it’s something that can really resonate.”

Anyone who worked on Inside Out could end up with their own life experiences creeping into the film. Story supervisor Josh Cooley, dad to a toddler, found himself capturing baby babble sounds at home for the voice of toddler Riley. Even some of tiny Riley’s actions, like charging around the house naked at bathtime, came from Cooley’s anecdotes.

Middle school is not necessarily the era of childhood that many of us remember fondly. Sharing experiences helped grow the movie's story, and was maybe even a little therapeutic for the creative team. “Growing up is a hard thing to do. It did kind of help me work through things both as a parent and even as a kid,” Docter said. “I think I still had remnant issues of having difficult times in junior high. I think to some degree that’s why I’m in animation. It was so hard to talk to other people. It was a lot easier to just sit in your room and draw. Because you still have something to say, you want to express yourself.”

As Docter and Rivera sat outside their “war room” at Pixar, Rivera nodded toward the space where they had spent countless hours working on the movie. “That’s where we made sense of the chaos.” A quote on the wall, the battle cry from the TV show Friday Night Lights, declared: “Clear eyes, full hearts, can’t lose.”   “We needed those words of wisdom to get us through,” Rivera said.

More than five years after their Inside Out journey began, it appeared that Docter and Rivera, not unlike Riley, have experienced the full range of emotional ups and downs. But on this day, there was not a hint of sadness, and a fair amount of joy. The pair seemed ready for whatever project they take on next.

When it comes to work, “All I care about is the movie,” said Rivera, who also teamed up with Docter on the Pixar hit Up. “And the reason I want it to do well is so that we can do another one. I think we agree on that. We’re going to keep making these until someone bigger than us stops us.”