Both the firearms discussed (AR-15 and 1911) have a failure mode where an acceleration spike (i.e. dropping or bumping it, but usually more like "slamming" it) on the muzzle can cause it to fire.
In the 1911 it's a weak or old firing pin spring of some models, and I think for very old models it's free-floating. Newer or upgraded ones the issue has been fixed, however a drop from as little as three feet onto a hard surface muzzle down can cause a 1911 to fire while on safe, and without the grip safety, etc. being activated. (If you own one, you should do some research on how yours works so you know the risks or make sure you have a TI firing pin and a good spring in it.)
On the AR-15, there is a free float firing pin that with a round in the chamber, could theoretically fire with a bump to the muzzle, and with certain types of wear and dirt, it becomes more likely. Likewise for chambering a round by pulling the charging handle and releasing the bolt / bcg. In a house when preparing an AR-15 for home defense, it's recommended to "ride" the bolt home and use the forward assist to lock the chamber closed.
As far as "walking around with it slung, bumped a tree and it fired" accidents, I don't know of any. Generally the "it just went off" stories are usually someone lying about actually having booger hooks on bang button. The risk of a vehicle coming off the roadway and running the pedestrian over is much higher. I wouldn't worry about it.
That said, it's rude to muzzle sweep someone period. Don't do it unless you are trying to be rude or engaging them in some way.