When you make a movie set in a commune where nudity and free love reign, it helps if your actors know each other beforehand.

On Thursday, Jennifer Aniston and Paul Rudd preemed Universal’s “Wanderlust” at the Mann Village Theater in Westwood, and on the red carpet, helmer David Wain said he was very happy they’d appeared together years ago in “The Object of My Affection,” not to mention a few episodes of “Friends.”

“Chemistry is everything and the fact that they had worked together in the past and were already friends only helped when they came together on set,” Wain noted.

The helmer, who wrote the laffer with Ken Marino, enthused over one scene where Rudd pumps himself up in front of the mirror before having sex. “And the funny thing is we almost ruined it because all of us were laughing so hard behind the camera,” he added.