In Act III scene 1, Hamlet has his famous interview with Ophelia whilst they are being watched by Claudius and Polonius. What is particularly interesting about this scene is that some productions show that Hamlet is aware of the presence of Claudius and Polonius, or that he becomes aware of their presence half way through his conversation. This could be one explanation of why he suddenly changes his attitude and his behaviour towards Ophelia. This change can be first seen in the following lines after he has asked Ophelia where her father is and she replies that he is at home:
Let the doors be shut upon him, that he may play the fool nowhere but in's own house. Farewell.
Brannagh's movie version of the play has this as the moment when Hamlet realises he is being watched by Claudius and Polonius, as he realises that Ophelia has just lied to him. This explains the subsequent angry, virtrolic outburst he expresses towards Ophelia when he wishes her a "plague" for her dowry. One way of explaining the sudden change in what he says is therefore through his awareness of the presence of Claudius and Polonius and the way that Ophelia--whom he loves--has betrayed him.