Robert Pattinson was 22 years old when he played Cedric Diggory in Harry Potter and the Goblet of Fire, released in 2005.