what was robert pattinson's part in harry potter?