Shia LaBeouf 'spent hours' ad-libbing on Transformers 3

Shia LaBeouf spent hours ad-libbing on the set of 'Transformers: Dark of the Moon'.

The actor - who portrays Sam Witwicky in the robot-fighting franchise - was pleased the technology used to make the film meant it was possible to shoot for hours at a time, and then later remove the unnecessary footage.

He said: "Because we're 3-D, you're shooting digital all the time," LaBeouf told MTV News. "The beauty for us is, let's say I'm doing a scene with [John] Malkovich or Frances [McDormand] or [Patrick] Dempsey or even Rosie [Huntington-Whiteley] - we'd just riff. You've got hours and hours of all that - where you're just riffing and ad libbing and trying to come up with lines."

Director Michael Bay was still working on the final edit of the movie - which runs to two hours and 40 minutes - just weeks before it was due to hit cinemas, but none of the cast were unhappy to see their scenes end up on the cutting room floor.

Rosie said: "I trust Michael so much on his judgment. He's made every single cast member look fantastic in this movie, and it's a long film, so he really has to choose the best scenes and what makes sense to the story line."

John added to MTV News: "You're a figure in someone else's dream, and however their dream plays out is the way it is."