you make a very important point, IMO, in that you in both cases had turned your vehicle's engine off
Yes, plus another equally important point: let the elephants come to you
Don't drive right up to them, hit the brakes, talk loudly, shove cameras out the windows, gesticulate and keep your engine running.
Instead, find a suitable spot at a suitable distance, switch off, sit quietly and wait.
It is in my experience not necessary to freeze, as long as you don't make sudden movements it is fine to look around, etc.
If you do it right, the elephants may or may not come to you.
If they don't, then tough, and better luck next time.
If they do, it is just so
cool! I've had a trunk shoved literally in my face, and then been sniffed all over for several minutes.
On of the interesting things about that was that the elephant (an old bull) whilst smelling intently blew out a very fine spray of saliva.
It was not smelly or sticky, but I did have to clean my glasses afterwards.
I also recall an instance of ending up in the middle of a herd of 60+ who were in a great state of agitation. The herd had blundered into a lion kill, and the lions had sensibly scattered.
I walked down into the river and found one of them pressed hard against the riverbank, with me on one side and over 60 enraged elephants on the other.
That lion sure didn't look comfortable. Two more lions were hiding in the bush.
There was only one track out, which took us right through the herd.
We did this very slowly, stopping often for as long as necessary. It took us something like forty minutes to make our way out.
The guy who was driving knew exactly what he was doing, so we were cool, but the elephants were going berserk all around us.
Running to and fro in a frenzy, trumpeting loudly and often, doing all the flapping and head shaking stuff, etc. etc.
All of this within meters of the vehicle, and on all sides.
They were upset about the lions, not us, but I think all the other people on the vehicle were scared completely out of their minds.
To this day, I’m surprised that nobody had a heart attack there and then. I loved every second of it.