“Everything was so glamorous and cool,” sighs “Hustlers” star Constance Wu of the last lucrative night her character spends working in the strip club before the 2008 stock market crash. The camera agrees. In slow motion, it gawks as 300 people collide like electrons. Men fling money, slide cash into spandex and gaze in awe at women who swing around poles, crawl on bar tops, stroke lapels, sit on laps and caress each other on stage. Usher even smacks Jennifer Lopez’s bottom.

“The great challenge was to make sure that this room felt alive and electric,” says writer/director Lorene Scafaria. To stage this scene, she needed to capture “the masculinity of it, and the energy and the exchange.” And to stage this scene safely — to control the chaos — she needed one more person: comfort consultant Jacqueline Frances, there to navigate the flying dollars and hyperactive hands and make sure every actor and extra knew the rules of conduct and contact.

This year, onscreen intimacy has been festive, charming, awkward, cruel and yes, even erotic. Thanks to conscientious filmmakers, it’s also been physically and emotionally safe, in part due to an ascendant generation of female directors and producers who are now in control of the set — many of whom were, or are, actors themselves.

Hollywood is ready for better sex. What does that look like behind the camera? Let’s focus on how four of this year’s most sensitive scenes were shot, starting with Scafaria’s den of decadence.

“I don’t think it was a guarantee that our film would have a comfort consultant,” says Scafaria, “even though I knew there needed to be someone who was very specifically there for the women to feel safe, and the men, too.”

Hiring Frances took convincing producers that the former dancer’s expertise was worth the cost — and wouldn’t slow down production. In fact, having Frances and pole coordinator Johanna Sapakie on hand turned out to “speed things along,” says Scafaria. When the “Hustlers” actors had character questions — like, how to handle a groping guest while still getting his money — Frances and Sapakie could answer how dancers, and the women playing them, can shift their bodies to maintain control.

“I had them next to me all day,” says Scafaria. “Nothing brought me more joy than when Jennifer or Constance would call out for Jaq.”

“I’ve worked with directors who seem to be completely unaware of how vulnerable it feels,” says actor and director Olivia Wilde on her past experiences shooting intimate scenes. “I can empathize completely with the actors, and [make] my experience a source of inspiration as well as a cautionary tale.” Directing the comedy “Booksmart,” Wilde wanted to offer her young actors “the experience that I felt I had deserved.”

In one scene, a high school senior, played by Kaitlyn Dever, fumbles through her first-ever sexual encounter with a female classmate, played by Diana Silvers.

“She’s experienced the good and the bad,” says Dever of Wilde, “but she was able to go, ‘OK, here’s what I’m not going to do on my movie.’” Particularly, notes Dever, sets that claim to be closed yet have extra people floating around without explanation.

Unlike Scafaria’s sprawl, Wilde had an opportunity to keep her set small. “People often misunderstand what a closed set should really mean,” says Wilde. She pared production down to four people: herself, the two actors and cinematographer Jason McCormick, who personally took over from the camera operator. Wilde and her actors rehearsed the major elements of the scene in advance, but saved their first kiss for the camera to leave space for Dever and Silvers to discover their characters’ actions, and reactions, in the room. McCormick’s camera movements had to be ready to improvise, but he knew to prioritize details like the girls fumbling with shoelaces over nudity.

“That partnership between the director and the cinematographer was essential because you don’t want to be talking over the scene,” says Wilde. “You really can damage a performance by making an actor feel anxious. Relaxation is the key.”

For extra privacy, Wilde turned off every monitor except the one she had in her hand. “Actors typically aren’t even made aware that there are at least a dozen monitors that are live at any point on the set,” says Wilde. “No one of outside of that room had any access to the live feed.”

“Queen & Slim” director Melina Matsoukas — no stranger to nudity as the showrunner of “Insecure” — prefers to choreograph every detail.

“There’s nothing loving or sexy about shooting a sex scene,” says Matsoukas. “A great way of going about dealing with the uncomfortableness with it is to treat it like a dance.”

For “Queen & Slim’s” centerpiece erotic scene between Daniel Kaluuya and Jodie Turner-Smith, in which their two strangers on the run prove their trust in each other, Matsoukas wanted the characters to “use each other’s body as a shield against the outside world.” Both Kaluuya and Turner-Smith contributed to the physical blocking, which was then drawn onto storyboards so everyone shared an identical image of the footage they were capturing.

“I think it’s much easier to understand what someone wants when they can see an actual picture,” says Matsoukas. “They know exactly where we’ll be in terms of their positions and what to expect.”

As for nudity, Matsoukas believes in gender parity. “How many times have we seen a woman’s breasts, but we never see a man’s parts?” she groans. “I knew I wanted to see his backside, and I knew I wanted to see her breasts — and play it so that it is an equal playing field.

“These two people are falling in love as a world is burning down around them, but they’re caught in their own bubble,” says Matsoukas. Metaphorically and literally. The scene takes place inside a car on a sunny road, but except for the camera department, the rest of the crew was sequestered inside a tent, or in the surrounding woods. Including Matsoukas herself. “I’m not in their eyeline,” she says. “I try to let them block everybody else out to make it real and authentic.”

“We weren’t seeing anyone but each other while we were doing the scene,” agrees Turner-Smith. “It just felt so respectful.”

Yet, when a film’s setting is Fox News headquarters — a place crowded with eyes — sometimes the trick is more cameras. For “Bombshell,” director Jay Roach often set up his equipment to shoot footage from all directions, “like a play,” says Margot Robbie, who plays an amalgamated character named Kayla pressured into a sexual relationship with John Lithgow’s bullying, abusive CEO Roger Ailes.

“It felt oppressive in all the right ways,” says Robbie. “It also gave you this feeling that you were being watched, which was hugely important to Kayla’s journey. I wanted her to feel like everyone in the office knew and they all were judging.”

“Just being naked is not necessarily when we’re at our most vulnerable,” adds co-star Charlize Theron, who both acted in “Bombshell” and produced. The film’s most wrenching moment is more about revealing power dynamics than nudity. Kayla is in a supposedly professional meeting with Ailes when he orders her to lift up her skirt and give him a twirl.

“The men on set were so disturbed by it,” says Theron. “She’s wearing what you would wear on a beach. But it is so uncomfortable to watch him dictate what’s going to happen in the room.”

Before filming, Roach called a meeting with all of the production heads and said, “I would recommend that we treat this set with the philosophy, ‘Be kinder than what’s necessary.’” Theron was there in solidarity when Robbie shot that scene. So, too, were extra cameras, which recorded the moment simultaneously from three set-ups to get through the assault in fewer, fresher takes.

“A huge help is when you can get more cameras on a day like that,” says Theron. “You cannot manufacture it over and over and over and over. If you get that one magical moment, you better get it from three angles.”

“It was a disturbing scene to read. It was a disturbing thing to reenact,” says Robbie. “But Jay is one of the most sensitive and emotionally in-tune directors I’ve ever worked with, so I felt completely safe.”

As “Bombshell” proves, security and danger can co-exist. As Hollywood continues to develop and share healthy, positive techniques for shooting intimate scenes, this increasing emphasis on actors’ safety encourages filmmakers to take more narrative risks.

“I’ve probably shied away from certain things in my writing because of wanting the set to always be a place for people to feel comfortable,” admits Scafaria. Collaborating with a comfort consultant has encouraged her to stretch her previous creative boundaries.

“It certainly opened my eyes to what’s possible,” says Scafaria. “I can take bigger risks on the page after knowing what’s possible on the set.”