Spaced out

To be confused or incoherent, to resemble someone who is using drugs, to be daydreaming.

The boy was totally spaced out when the teacher asked him a question about his homework.