The so-called trolley problem asks if you’d rather let five people die or kill one person yourself to save the group. Virtual reality and neuroimaging are helping us discover what goes through our heads when we decide.