This happens for prolonged durations during the dreaming state. Our dreams often seem so vivid and detailed, but they weren’t our conscious creations. The mind conjures them up and gets very creative. This brings me to that statement Morpheus makes to Neo in “The Matrix”:
Have you ever had a dream, Neo, that you were so sure was real? What if you were unable to wake from that dream? How would you know the difference between the dream world and the real world?
(via Gadadhara Pandit Dasa: The Bhagavad Gita: You Are Not Your Mind)