He couldn't use this setting without rearranging the play's timeline. In the play, the fourth soliloquy comes after Polonius and Claudius set up a seemingly chance encounter between Ophelia and Hamlet. Claudius and Polonius exit to hide and spy on the encounter, while Ophelia remains on stage. Hamlet enters and speaks the soliloquy. When he's finished, he and Ophelia meet and have their horrifying "get thee to a nunnery" confrontation. Because Olivier's tower lacks hiding places for Claudius and Polonius and isn't a likely place for Hamlet to run into Ophelia, Olivier needed to rearrange the story if he wanted to set the soliloquy there. So in his film, the soliloquy comes after the "get thee to a nunnery" confrontation (Zeffirelli makes the same choice). This change also fits Olivier's handling of the Hamlet-Ophelia story, which makes Hamlet less cruel and more obviously in love with Ophelia than he is in the play. When Olivier's Hamlet tells Ophelia to go to a nunnery, we know he's trying to help her, to get her out of the castle so she'll be safe. Hiding the truth and behaving cruelly hurts Olivier's Hamlet so much that it drives him to the fourth soliloquy's suicidal thoughts, just as his disgust with his mother drives him to the first's.
Last glimpse of Ophelia.
Hamlet looks at the sea before
beginning his fourth soliloquy.
The very place puts toys of desperation,
Without more motive, into every brain
That looks so many fathoms to the sea
And hears it roar beneath.
"To be or not to be . . ."
". . . perchance to dream."
Hamlet's determination to kill himself has evaporated. He leans on his elbow and meditates on life's setbacks—unrequited love, scorn, the law's delay (74-75). As he lists these aggravations, we hear the monotonous sound of the waves. Once again, Hamlet thinks of a way out, of making his quietus with bare bodkin (78). He looks at his dagger, reflecting that we would all make our own final exits if not for the fear of death, which "puzzles the will" (82). Puzzled, lost in his meditation, he accidentally drops the dagger, a gesture that illustrates his point.
He turns away from the sea and looks into a fog that is like the "pale cast of thought" (87). Then he stands and walks to the tower's edge. Gazing out, he thinks of how "enterprises of great pith and moment" (88) are affected by these considerations. Turning, he says that such enterprises "turn awry" (89), and walking toward the steps, he says that they "lose the name of action" (90). Mournful cellos play as he descends into the fog and the screen goes black.
Walton's music and Olivier's setting, editing, camera movements, voice, facial expressions, and gestures have illustrated the soliloquy's every twist.