Hi, Thanks for query.
Twitching might be due to irritation of some nerve
endings probably due to infection surrounding.
As you got pain in right eye ball,there might be sinus infection
Go for x ray
para nasal sinuses
to rule out sinus infection.
Put some antibiotic eye drops if there is local infection.
Ok and bye.