Neil Patrick Harris has revealed his sex scene in the upcoming Gone Girl film was "almost robotic".

The actor - who is openly gay and engaged to partner David Burtka - gets intimate with actress Rosamund Pike in the big screen adaptation of Gillian Flynn's thriller.

He told Out magazine that director David Fincher was very specific about what he wanted.

He explained: "We had to rehearse the sex scene with David, like every inch of it.

"It was weird because we're technically breaking down the sex scene. He wanted it to be almost robotic, that we know exactly where we are, position-wise, where everything goes.

"And yet, through all of that, the whole 'I'm gay' element was never even thought about."

The How I Met Your Mother star is also about to star in the stage production of Hedwig And The Angry Inch, a musical about an East German transgender singer.

And he confessed the character is "bringing up a lot of super insecure things within me".

"I have never thought drag was intoxicating, I've never had a fun drunken Halloween in drag, never been in heels, really," said the 40-year-old.

"I've lived my whole life being attracted by masculinity - it's why I like guys. I'm not a super effete person, and I have to turn into that, and in doing so it brings up a lot of homophobic insecurities within myself."