There are people who make mistakes, or who behave in a compulsive manner, or who have bad social skills--and there are those who very carefully orchestrate their attacks in order to hide them from people in a position to stop them.
One is being a jerk, and one is being a predator, and they are different.
But, yeah--it's not THAT HARD to obtain consent for a hug. You (general) make eye contact (preferably with somebody you've known for at least fifteen minutes), open your arms slightly, and wait to see if they make a similar gesture. If they don't, or if they say, "I'm sorry, hugging makes me uncomfortable," you say, "Oh, sorry, thanks for letting me know.